com.caucho.sql
Class UserStatement

java.lang.Object
  extended by com.caucho.sql.UserStatement
All Implemented Interfaces:
java.sql.Statement, java.sql.Wrapper
Direct Known Subclasses:
UserPreparedStatement

public class UserStatement
extends java.lang.Object
implements java.sql.Statement

User-view of a statement;


Field Summary
protected  UserConnection _conn
           
protected  boolean _isPoolable
           
protected  java.sql.Statement _stmt
           
protected static L10N L
           
 
Fields inherited from interface java.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
 
Method Summary
 void addBatch(java.lang.String sql)
           
 void cancel()
           
 void clearBatch()
           
 void clearWarnings()
           
 void close()
          Closes the statement.
 boolean execute(java.lang.String sql)
          executes the given sql.
 boolean execute(java.lang.String query, int resultType)
          executes the given query with its result type.
 boolean execute(java.lang.String query, int[] columns)
          executes the given query with the columns given for primary key generation.
 boolean execute(java.lang.String query, java.lang.String[] columns)
          executes the given query with the columns given for primary key generation.
 int[] executeBatch()
          Executes the batched sql.
 java.sql.ResultSet executeQuery(java.lang.String sql)
          queries the database with the given sql.
 int executeUpdate(java.lang.String sql)
          updates the database with the given sql.
 int executeUpdate(java.lang.String query, int resultType)
          Execute an update with the given result type.
 int executeUpdate(java.lang.String query, int[] columns)
          Execute an update checking the given columns for primary keys.
 int executeUpdate(java.lang.String query, java.lang.String[] columns)
          Execute an update checking the given columns for primary keys.
 java.sql.Connection getConnection()
          Returns the underlying connection.
 int getFetchDirection()
          Returns the current fetch direction.
 int getFetchSize()
          Returns the fetch size.
 java.sql.ResultSet getGeneratedKeys()
          Returns the generated keys for the update.
 int getMaxFieldSize()
          Returns the maximum field size.
 int getMaxRows()
          Returns the maximum rows returned by a query.
 boolean getMoreResults()
          Returns true if more results are available.
 boolean getMoreResults(int count)
          Returns the next count results.
 int getQueryTimeout()
          Returns the current query timeout.
 java.sql.ResultSet getResultSet()
          Returns the result set of the last query.
 int getResultSetConcurrency()
          Returns the statement's result set concurrency setting.
 int getResultSetHoldability()
          Returns the result set holdability.
 int getResultSetType()
          Returns the statement's result set type.
 java.sql.Statement getStatement()
          Returns the underlying statement.
 int getUpdateCount()
          Returns the update count of the last query.
 java.sql.SQLWarning getWarnings()
          Returns the current sql warnings.
 boolean isClosed()
           
 boolean isPoolable()
           
 boolean isWrapperFor(java.lang.Class<?> iface)
           
protected  void killPool()
          Marks the connection as non-poolable.
protected  void onRuntimeException(java.lang.RuntimeException e)
           
protected  void onSqlException(java.sql.SQLException e)
           
 void setCursorName(java.lang.String name)
          Sets the current cursor name.
 void setEscapeProcessing(boolean enable)
          Enables escape processing.
 void setFetchDirection(int direction)
          Sets the fetch direction.
 void setFetchSize(int rows)
          Sets the fetch size.
 void setMaxFieldSize(int max)
          Sets the maximum field size.
 void setMaxRows(int max)
          Sets the maximum rows returned by a query.
 void setPoolable(boolean poolable)
           
 void setQueryTimeout(int seconds)
          Sets the query timeout.
 java.lang.String toString()
           
<T> T
unwrap(java.lang.Class<T> iface)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

L

protected static final L10N L

_conn

protected UserConnection _conn

_stmt

protected java.sql.Statement _stmt

_isPoolable

protected boolean _isPoolable
Method Detail

setPoolable

public void setPoolable(boolean poolable)
Specified by:
setPoolable in interface java.sql.Statement

isPoolable

public boolean isPoolable()
Specified by:
isPoolable in interface java.sql.Statement

getStatement

public java.sql.Statement getStatement()
Returns the underlying statement.


addBatch

public void addBatch(java.lang.String sql)
              throws java.sql.SQLException
Specified by:
addBatch in interface java.sql.Statement
Throws:
java.sql.SQLException

cancel

public void cancel()
            throws java.sql.SQLException
Specified by:
cancel in interface java.sql.Statement
Throws:
java.sql.SQLException

clearBatch

public void clearBatch()
                throws java.sql.SQLException
Specified by:
clearBatch in interface java.sql.Statement
Throws:
java.sql.SQLException

clearWarnings

public void clearWarnings()
                   throws java.sql.SQLException
Specified by:
clearWarnings in interface java.sql.Statement
Throws:
java.sql.SQLException

close

public void close()
           throws java.sql.SQLException
Closes the statement.

Specified by:
close in interface java.sql.Statement
Throws:
java.sql.SQLException

executeQuery

public java.sql.ResultSet executeQuery(java.lang.String sql)
                                throws java.sql.SQLException
queries the database with the given sql.

Specified by:
executeQuery in interface java.sql.Statement
Throws:
java.sql.SQLException

executeUpdate

public int executeUpdate(java.lang.String sql)
                  throws java.sql.SQLException
updates the database with the given sql.

Specified by:
executeUpdate in interface java.sql.Statement
Throws:
java.sql.SQLException

executeUpdate

public int executeUpdate(java.lang.String query,
                         int resultType)
                  throws java.sql.SQLException
Execute an update with the given result type.

Specified by:
executeUpdate in interface java.sql.Statement
Throws:
java.sql.SQLException

executeUpdate

public int executeUpdate(java.lang.String query,
                         int[] columns)
                  throws java.sql.SQLException
Execute an update checking the given columns for primary keys.

Specified by:
executeUpdate in interface java.sql.Statement
Throws:
java.sql.SQLException

executeUpdate

public int executeUpdate(java.lang.String query,
                         java.lang.String[] columns)
                  throws java.sql.SQLException
Execute an update checking the given columns for primary keys.

Specified by:
executeUpdate in interface java.sql.Statement
Throws:
java.sql.SQLException

execute

public boolean execute(java.lang.String sql)
                throws java.sql.SQLException
executes the given sql.

Specified by:
execute in interface java.sql.Statement
Throws:
java.sql.SQLException

execute

public boolean execute(java.lang.String query,
                       int resultType)
                throws java.sql.SQLException
executes the given query with its result type.

Specified by:
execute in interface java.sql.Statement
Throws:
java.sql.SQLException

execute

public boolean execute(java.lang.String query,
                       int[] columns)
                throws java.sql.SQLException
executes the given query with the columns given for primary key generation.

Specified by:
execute in interface java.sql.Statement
Throws:
java.sql.SQLException

execute

public boolean execute(java.lang.String query,
                       java.lang.String[] columns)
                throws java.sql.SQLException
executes the given query with the columns given for primary key generation.

Specified by:
execute in interface java.sql.Statement
Throws:
java.sql.SQLException

executeBatch

public int[] executeBatch()
                   throws java.sql.SQLException
Executes the batched sql.

Specified by:
executeBatch in interface java.sql.Statement
Throws:
java.sql.SQLException

getResultSet

public java.sql.ResultSet getResultSet()
                                throws java.sql.SQLException
Returns the result set of the last query.

Specified by:
getResultSet in interface java.sql.Statement
Throws:
java.sql.SQLException

getUpdateCount

public int getUpdateCount()
                   throws java.sql.SQLException
Returns the update count of the last query.

Specified by:
getUpdateCount in interface java.sql.Statement
Throws:
java.sql.SQLException

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Returns the underlying connection.

Specified by:
getConnection in interface java.sql.Statement
Throws:
java.sql.SQLException

getFetchDirection

public int getFetchDirection()
                      throws java.sql.SQLException
Returns the current fetch direction.

Specified by:
getFetchDirection in interface java.sql.Statement
Throws:
java.sql.SQLException

setFetchDirection

public void setFetchDirection(int direction)
                       throws java.sql.SQLException
Sets the fetch direction.

Specified by:
setFetchDirection in interface java.sql.Statement
Throws:
java.sql.SQLException

getFetchSize

public int getFetchSize()
                 throws java.sql.SQLException
Returns the fetch size.

Specified by:
getFetchSize in interface java.sql.Statement
Throws:
java.sql.SQLException

setFetchSize

public void setFetchSize(int rows)
                  throws java.sql.SQLException
Sets the fetch size.

Specified by:
setFetchSize in interface java.sql.Statement
Throws:
java.sql.SQLException

getMaxFieldSize

public int getMaxFieldSize()
                    throws java.sql.SQLException
Returns the maximum field size.

Specified by:
getMaxFieldSize in interface java.sql.Statement
Throws:
java.sql.SQLException

setMaxFieldSize

public void setMaxFieldSize(int max)
                     throws java.sql.SQLException
Sets the maximum field size.

Specified by:
setMaxFieldSize in interface java.sql.Statement
Throws:
java.sql.SQLException

getMaxRows

public int getMaxRows()
               throws java.sql.SQLException
Returns the maximum rows returned by a query.

Specified by:
getMaxRows in interface java.sql.Statement
Throws:
java.sql.SQLException

setMaxRows

public void setMaxRows(int max)
                throws java.sql.SQLException
Sets the maximum rows returned by a query.

Specified by:
setMaxRows in interface java.sql.Statement
Throws:
java.sql.SQLException

getMoreResults

public boolean getMoreResults()
                       throws java.sql.SQLException
Returns true if more results are available.

Specified by:
getMoreResults in interface java.sql.Statement
Throws:
java.sql.SQLException

getQueryTimeout

public int getQueryTimeout()
                    throws java.sql.SQLException
Returns the current query timeout.

Specified by:
getQueryTimeout in interface java.sql.Statement
Throws:
java.sql.SQLException

setQueryTimeout

public void setQueryTimeout(int seconds)
                     throws java.sql.SQLException
Sets the query timeout.

Specified by:
setQueryTimeout in interface java.sql.Statement
Throws:
java.sql.SQLException

getResultSetConcurrency

public int getResultSetConcurrency()
                            throws java.sql.SQLException
Returns the statement's result set concurrency setting.

Specified by:
getResultSetConcurrency in interface java.sql.Statement
Throws:
java.sql.SQLException

getResultSetType

public int getResultSetType()
                     throws java.sql.SQLException
Returns the statement's result set type.

Specified by:
getResultSetType in interface java.sql.Statement
Throws:
java.sql.SQLException

getWarnings

public java.sql.SQLWarning getWarnings()
                                throws java.sql.SQLException
Returns the current sql warnings.

Specified by:
getWarnings in interface java.sql.Statement
Throws:
java.sql.SQLException

setCursorName

public void setCursorName(java.lang.String name)
                   throws java.sql.SQLException
Sets the current cursor name.

Specified by:
setCursorName in interface java.sql.Statement
Throws:
java.sql.SQLException

setEscapeProcessing

public void setEscapeProcessing(boolean enable)
                         throws java.sql.SQLException
Enables escape processing.

Specified by:
setEscapeProcessing in interface java.sql.Statement
Throws:
java.sql.SQLException

getMoreResults

public boolean getMoreResults(int count)
                       throws java.sql.SQLException
Returns the next count results.

Specified by:
getMoreResults in interface java.sql.Statement
Throws:
java.sql.SQLException

getGeneratedKeys

public java.sql.ResultSet getGeneratedKeys()
                                    throws java.sql.SQLException
Returns the generated keys for the update.

Specified by:
getGeneratedKeys in interface java.sql.Statement
Throws:
java.sql.SQLException

getResultSetHoldability

public int getResultSetHoldability()
                            throws java.sql.SQLException
Returns the result set holdability.

Specified by:
getResultSetHoldability in interface java.sql.Statement
Throws:
java.sql.SQLException

isClosed

public boolean isClosed()
                 throws java.sql.SQLException
Specified by:
isClosed in interface java.sql.Statement
Throws:
java.sql.SQLException

unwrap

public <T> T unwrap(java.lang.Class<T> iface)
         throws java.sql.SQLException
Specified by:
unwrap in interface java.sql.Wrapper
Throws:
java.sql.SQLException

isWrapperFor

public boolean isWrapperFor(java.lang.Class<?> iface)
                     throws java.sql.SQLException
Specified by:
isWrapperFor in interface java.sql.Wrapper
Throws:
java.sql.SQLException

onSqlException

protected void onSqlException(java.sql.SQLException e)

onRuntimeException

protected void onRuntimeException(java.lang.RuntimeException e)

killPool

protected void killPool()
Marks the connection as non-poolable. When the connection is closed, it will actually be closed, not returned to the idle pool.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object