Share via


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
Gg926457.pubmethod(en-us,AX.60).gif cancelTimeOut Cancels a previous method call to the setTimeOut method. (Inherited from Object.)
Gg926457.pubmethod(en-us,AX.60).gif close Releases the database resources of a statement object.
Gg926457.pubmethod(en-us,AX.60).gif equal Determines whether the specified object is equal to the current one. (Inherited from Object.)
Gg926457.pubmethod(en-us,AX.60).gif executeQuery Executes an SQL statement that returns an instance of the .
Gg926457.pubmethod(en-us,AX.60).gif executeUpdate Executes a SQL INSERT, UPDATE, or DELETE statement.
Gg926457.pubmethod(en-us,AX.60).gif getLastError Retrieves the error code returned by the SQL database backend for the last SQL operation.
Gg926457.pubmethod(en-us,AX.60).gif getLastErrorText Retrieves the error text that is returned by the SQL database backend for the last SQL operation.
Gg926457.pubmethod(en-us,AX.60).gif getMaxFieldSize Returns the current maximum column size limit, if any.
Gg926457.pubmethod(en-us,AX.60).gif getTimeOutTimerHandle Returns the timer handle for the object. (Inherited from Object.)
Gg926457.pubmethod(en-us,AX.60).gif handle Retrieves the handle of the class of the object. (Inherited from Object.)
Gg926457.pubmethod(en-us,AX.60).gif new Initializes a new instance of the Object class. (Inherited from Object.)
Gg926457.pubmethod(en-us,AX.60).gif notify Releases the hold on an object that has called the wait method on this object. (Inherited from Object.)
Gg926457.pubmethod(en-us,AX.60).gif notifyAll Releases a lock on the object that was issued by the wait method on this object. (Inherited from Object.)
Gg926457.pubmethod(en-us,AX.60).gif objectOnServer Determines whether the object is on a server. (Inherited from Object.)
Gg926457.pubmethod(en-us,AX.60).gif owner Returns the instance that owns the object. (Inherited from Object.)
Gg926457.pubmethod(en-us,AX.60).gif setMaxFieldSize Sets the maximum column size limit.
Gg926457.pubmethod(en-us,AX.60).gif setTimeOut Sets up the scheduled execution of a specified method. (Inherited from Object.)
Gg926457.pubmethod(en-us,AX.60).gif toString Returns a string that represents the current object. (Inherited from Object.)
Gg926457.pubmethod(en-us,AX.60).gif usageCount Returns the current number of references, that is, the value of the reference counter, that the object has. (Inherited from Object.)
Gg926457.pubmethod(en-us,AX.60).gif wait Pauses a process. (Inherited from Object.)
Gg926457.pubmethod(en-us,AX.60).gif 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

See Also

ResultSet Class

Connection.createStatement Method