Statement关于execute()方法返回值的问题

Executes the given SQL statement, which may return multiple results. In some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this unless you are (1) executing a stored procedure that you know may return multiple results or (2) you are dynamically executing an unknown SQL string.
The execute method executes an SQL statement and indicates the form of the first result. You must then use the methods getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s).


Parameters:
sql - any SQL statement
Returns:
true if the first result is a ResultSet object; false if it is an update count or there are no results

该方法是为了执行参数sql语句的,他可能返回多种返回值。在一些不常见的情况下,一个语句有可能返回多个返回值(返回值集或更新个数)。一般情况下,我们可以不必在意这个问题,除非是用来执行一个存储过程或者执行一个未知的动态的sql语句。
这个execute方法执行一个sql语句并且指向第一个返回值。你必须使用getResultSet或者getUpdateCount方法去获得返回值,也可以使用getMoreResults来获得一系列的返回值。
参数:
任意的sql语句
返回值:
true表示第一个返回值是一个ResultSet对象;false表示这是一个更新个数或者没有结果集。
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值