Statement Class

The Statement class executes a static SQL statement and obtains the results it produces.

class Statement extends Object

Run On

Called

Methods

Method

Description

cancelTimeOut

Cancels a previous method call to the Object.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 ResultSet Class.

executeUpdate

Executes an SQL INSERT, UPDATE, or DELETE statement. SQL statements that return nothing, such as SQLDDL statements, can also be executed.

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 a wait method on this object. (Inherited from Object.)

notifyAll

Releases a lock on the object that was issued by a 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 (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.)

Remarks

Only one ResultSet Class 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.

Example

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);
    }
}

See Also

ResultSet Class

Connection.createStatement Method