`
flashdream8
  • 浏览: 667327 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

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

SQL 
阅读更多

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表示这是一个更新个数或者没有结果集。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics