Statement Class
The Statement class executes a static SQL statement and obtains the results it produces.
Syntax
class Statement extends Object
Run On
Called
Methods
Method | Description | |
---|---|---|
cancelTimeOut | Cancels a previous method call to the setTimeOut method. (Inherited from Object.) | |
close | Releases the database resources of a statement object. | |
equal | Determines whether the specified object is equal to the current one. (Inherited from Object.) | |
executeQuery | Executes an SQL statement that returns an instance of the . | |
executeUpdate | Executes a SQL INSERT, UPDATE, or DELETE statement. | |
getLastError | Retrieves the error code returned by the SQL database backend for the last SQL operation. | |
getLastErrorText | Retrieves the error text that is returned by the SQL database backend for the last SQL operation. | |
getMaxFieldSize | Returns the current maximum column size limit, if any. | |
getTimeOutTimerHandle | Returns the timer handle for the object. (Inherited from Object.) | |
handle | Retrieves the handle of the class of the object. (Inherited from Object.) | |
new | Initializes a new instance of the Object class. (Inherited from Object.) | |
notify | Releases the hold on an object that has called the wait method on this object. (Inherited from Object.) | |
notifyAll | Releases a lock on the object that was issued by the wait method on this object. (Inherited from Object.) | |
objectOnServer | Determines whether the object is on a server. (Inherited from Object.) | |
owner | Returns the instance that owns the object. (Inherited from Object.) | |
setMaxFieldSize | Sets the maximum column size limit. | |
setTimeOut | Sets up the scheduled execution of a specified method. (Inherited from Object.) | |
toString | Returns a string that represents the current object. (Inherited from Object.) | |
usageCount | Returns the current number of references, that is, the value of the reference counter, that the object has. (Inherited from Object.) | |
wait | Pauses a process. (Inherited from Object.) | |
xml | Returns an XML string that represents the current object. (Inherited from Object.) |
Top
Remarks
Only one per Statement can be open at any point in time. Therefore, if the reading of one ResultSet is interleaved with the reading of another, each must have been generated by different Statements.
Record and field level securities are not enforced on the Statement class. Therefore, make sure you are not exposing data returned to the user without doing explicit security validation.
All statement executed methods implicitly close a statement's current ResultSet if an open one exists.
Examples
static void example()
{
Connection Con;
Statement Stmt;
ResultSet R;
SqlStatementExecutePermission perm;
str sql = 'SELECT VALUE FROM SQLSYSTEMVARIABLES';
Con = new Connection();
Stmt = Con.createStatement();
perm = new SqlStatementExecutePermission(sql);
perm.assert();
R = Stmt.executeQuery(sql);
while ( R.next() )
{
print R.getString(1);
}
}
Inheritance Hierarchy
Object Class
Statement Class