com.j256.ormlite.support
Interface CompiledStatement


public interface CompiledStatement

An internal reduction of the SQL PreparedStatment so we can implement its functionality outside of JDBC.

Author:
graywatson

Method Summary
 void close()
          Close the statement.
 void closeQuietly()
          Close the statement but swallows any SQLExceptions.
 int getColumnCount()
          Returns the number of columns in this statement.
 String getColumnName(int columnIndex)
          Get the designated column's name.
 int runExecute()
          Run the prepared execute statement returning the number of rows affected.
 DatabaseResults runQuery(ObjectCache objectCache)
          Run the prepared query statement returning the results.
 int runUpdate()
          Run the prepared update statement returning the number of rows affected.
 void setMaxRows(int max)
          Set the number of rows to return in the results.
 void setObject(int parameterIndex, Object obj, SqlType sqlType)
          Set the parameter specified by the index and type to be an object.
 void setQueryTimeout(long millis)
          Set the query timeout in milliseconds.
 

Method Detail

getColumnCount

int getColumnCount()
                   throws SQLException
Returns the number of columns in this statement.

Throws:
SQLException

getColumnName

String getColumnName(int columnIndex)
                     throws SQLException
Get the designated column's name.

Throws:
SQLException

runUpdate

int runUpdate()
              throws SQLException
Run the prepared update statement returning the number of rows affected.

Throws:
SQLException

runQuery

DatabaseResults runQuery(ObjectCache objectCache)
                         throws SQLException
Run the prepared query statement returning the results.

Throws:
SQLException

runExecute

int runExecute()
               throws SQLException
Run the prepared execute statement returning the number of rows affected.

Throws:
SQLException

close

void close()
           throws SQLException
Close the statement.

Throws:
SQLException

closeQuietly

void closeQuietly()
Close the statement but swallows any SQLExceptions.


setObject

void setObject(int parameterIndex,
               Object obj,
               SqlType sqlType)
               throws SQLException
Set the parameter specified by the index and type to be an object.

Parameters:
parameterIndex - Index of the parameter with 0 being the first parameter, etc..
obj - Object that we are setting. Can be null.
sqlType - SQL type of the parameter.
Throws:
SQLException

setMaxRows

void setMaxRows(int max)
                throws SQLException
Set the number of rows to return in the results.

Throws:
SQLException

setQueryTimeout

void setQueryTimeout(long millis)
                     throws SQLException
Set the query timeout in milliseconds. This may or may not be supported by all database types. Although this is in milliseconds, the underlying timeout resolution may be in seconds.

WARNING: This will stop the query connection but it will _not_ terminate the query if it is already be running by the database.

Throws:
SQLException


This documentation is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.