Overview Module Function Class Tea 3.2.4 Reference Documentation
© 2009 PDM&FC

Class TStatement

Used to execute SQL commands.

Method Summary
close
         Releases all the database resources held by this object.
execute sqlStatement
         Executes an arbitrary SQL statement.
getFetchSize
         Fetches the number of rows that are internally retrieved for a TResultSet.
getMoreResults
         Fetches the TStatement next result.
getResultSet
         Returns the current result as a TResultSet.
query sqlStatement
         Executes a SQL query.
setFetchSize numberOfRows
         Sets the number of rows that should be internally retrieved for a TResultSet.
update sqlStatement
         Executes a SQL statement that modifies the contents of the database.

Method Detail

close

TStatement close

Releases all the database resources held by this object.

Releases all the database resources used by this object. The object can then no longer be used. All the TResultSet created by this object that are still opened are also closed automatically.

execute

TStatement execute sqlStatement

Executes an arbitrary SQL statement.

Parameters:
sqlStatement - A string representing a SQL statement.
Returns:
True if there were one or more result sets as a result from the execution of the SQL statement.

Executes a SQL statement on the database this TStatement is associated with. This method is tipically used to execute stored procedures, but it can also execute any type os SQL statement. If there is something wrong with the sqlStatement string (e.g. a syntax error) a runtime error will ocurr.

If this method returns true then the result set can be obtained by calling getResultSet. Multiple result sets can be obtained by calling getMoreResults and getResultSet in sequence as appropriate.


getFetchSize

TStatement getFetchSize

Fetches the number of rows that are internally retrieved for a TResultSet.

Returns:
An integer.

Retrieves the number of result set rows that is the default fetch size for TResultSet objects generated from this TStatement object. If this TStatement object has not set a fetch size by calling the method setFetchSize, the return value is implementation-specific.

Since: 3.2.1

getMoreResults

TStatement getMoreResults

Fetches the TStatement next result.

Returns:
True if the next result is a result set. False otherwise.

Fetches the statement next result. It will return true if the next result is a TResultSet. In that case the result set can be obtained by invoking getResultSet. This method is to be called only once per result.

By using the execute method it is possible to execute SQL statement that return multipe result sets. This method combined with getResultSet give access to those result sets as instances of .

Since: 3.1.5

getResultSet

TStatement getResultSet

Returns the current result as a TResultSet.

Returns:
A TResultSet instance.

Fetches the current result as a TResultSet object. This method is to be called only once per result.

By using the execute method it is possible to execute SQL statement that return multipe result sets. This method combined with getMoreResults give access to those result sets as instances of .

Since: 3.1.5

query

TStatement query sqlStatement

Executes a SQL query.

Parameters:
sqlStatement - A string representing a SQL statement with a SELECT command.
Returns:
An instance of TResultSet that represents the result of the execution of the sqlStatement query.

Executes a SQL query on the database this TStatement is associated with. It returns a TResultSet object containing the records resulting from the query. If there is something wrong with the sqlStatement string (e.g. a syntax error) then an runtime error ocurrs.

The instance of TResultSet returned by the method can be used to iterate through the records that resulted from the query.


setFetchSize

TStatement setFetchSize numberOfRows

Sets the number of rows that should be internally retrieved for a TResultSet.

Parameters:
numberOfRows - An integer.
Returns:
An integer.

Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed. The number of rows specified affects only result sets created using this statement. If the value specified is zero, then the hint is ignored. The default value is zero.

An error will occur if this value if out of the bounds 0..maxRows where maxRows is the maximum number of rows that a TResultSet may return.

Since: 3.2.1

update

TStatement update sqlStatement

Executes a SQL statement that modifies the contents of the database.

Parameters:
sqlStatement - A string representing a SQL statement with an UPDATE, INSERT or DELETE command.
Returns:
An integer object representing the number of records modified in the database.

Executes a SQL statement on the database this TStatement is associated with. The statement is supposed to modify, insert or remove records in the database. If there is something wrong with the sqlStatement string (e.g. a syntax error) or if the changes would violate an integrity constraint then an runtime error will ocurr.


Overview Module Function Class Tea 3.2.4 Reference Documentation
© 2009 PDM&FC
Report a bug or request new features
© 2009