com.caucho.quercus.lib.db
Class JdbcStatementResource

java.lang.Object
  extended by com.caucho.quercus.lib.db.JdbcStatementResource
Direct Known Subclasses:
JdbcPreparedStatementResource

public class JdbcStatementResource
extends java.lang.Object


Constructor Summary
JdbcStatementResource(JdbcConnectionResource conn)
           
 
Method Summary
 boolean bindResults(Env env, Value[] outParams)
          XXX: MySQL returns the table metadata on preparation of a statement, but java.sql doesn't support this feature.
protected  boolean close()
          Closes the result set, if any, and closes this statement.
protected  JdbcResultResource createResultSet(java.sql.ResultSet rs)
           
protected  boolean dataSeek(int offset)
          Advance the cursor the number of rows given by offset.
protected  boolean execute(Env env)
           
protected  boolean execute(Env env, boolean isCatchException)
           
protected  boolean executeImpl(Env env)
           
protected  Value fetch(Env env)
           
 boolean freeResult()
          Frees the associated result.
protected  int getColumnCount(Env env)
           
protected  JdbcConnectionResource getConnection()
           
protected  int getErrorCode()
          Returns the error number for the last error.
protected  java.lang.String getErrorMessage()
          Returns the error message for the last error.
 int getFieldCount()
          Returns the number of fields in the result set.
protected  java.sql.Connection getJavaConnection(Env env)
           
protected  java.sql.ResultSetMetaData getMetaData()
          Returns the meta data for corresponding to the current result set.
 int getNumRows()
          Returns the number of rows in the result set.
protected  java.lang.String getQuery()
           
 JdbcResultResource getResultSet()
           
 java.lang.String getStatementType()
          Returns this statement type.
protected  boolean isFetchFieldIndexBeforeFieldName()
           
protected  java.lang.String lastInsertId(Env env)
           
protected  boolean prepareForExecute(Env env)
           
protected  void setError(Env env, java.sql.SQLException e)
           
protected  void setErrorCode(int code)
           
protected  void setErrorMessage(java.lang.String msg)
           
protected  void setQuery(java.lang.String query)
           
protected  void setResultSet(java.sql.ResultSet rs)
           
protected  void setStatement(java.sql.Statement stmt)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JdbcStatementResource

public JdbcStatementResource(JdbcConnectionResource conn)
Method Detail

getQuery

protected java.lang.String getQuery()

setQuery

protected void setQuery(java.lang.String query)

getStatementType

public java.lang.String getStatementType()
Returns this statement type.

Returns:
this statement type: SELECT, UPDATE, DELETE, INSERT, CREATE, DROP, ALTER, BEGIN, DECLARE, or UNKNOWN.

bindResults

public boolean bindResults(Env env,
                           Value[] outParams)
XXX: MySQL returns the table metadata on preparation of a statement, but java.sql doesn't support this feature.


getColumnCount

protected int getColumnCount(Env env)

close

protected boolean close()
Closes the result set, if any, and closes this statement.


dataSeek

protected boolean dataSeek(int offset)
Advance the cursor the number of rows given by offset.

Parameters:
offset - the number of rows to move the cursor
Returns:
true on success or false on failure

getErrorCode

protected int getErrorCode()
Returns the error number for the last error.

Returns:
the error number

getErrorMessage

protected java.lang.String getErrorMessage()
Returns the error message for the last error.

Returns:
the error message

execute

protected boolean execute(Env env)

execute

protected final boolean execute(Env env,
                                boolean isCatchException)
                         throws java.sql.SQLException
Throws:
java.sql.SQLException

setError

protected void setError(Env env,
                        java.sql.SQLException e)

prepareForExecute

protected boolean prepareForExecute(Env env)
                             throws java.sql.SQLException
Throws:
java.sql.SQLException

executeImpl

protected boolean executeImpl(Env env)
                       throws java.sql.SQLException
Throws:
java.sql.SQLException

createResultSet

protected JdbcResultResource createResultSet(java.sql.ResultSet rs)

fetch

protected Value fetch(Env env)

freeResult

public boolean freeResult()
Frees the associated result.

Returns:
true on success or false on failure

getMetaData

protected java.sql.ResultSetMetaData getMetaData()
                                          throws java.sql.SQLException
Returns the meta data for corresponding to the current result set.

Returns:
the result set meta data
Throws:
java.sql.SQLException

getNumRows

public int getNumRows()
               throws java.sql.SQLException
Returns the number of rows in the result set.

Returns:
the number of rows in the result set
Throws:
java.sql.SQLException

getFieldCount

public int getFieldCount()
Returns the number of fields in the result set.

Parameters:
env - the PHP executing environment
Returns:
the number of fields in the result set

lastInsertId

protected java.lang.String lastInsertId(Env env)
                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

setStatement

protected void setStatement(java.sql.Statement stmt)

getResultSet

public JdbcResultResource getResultSet()

setResultSet

protected void setResultSet(java.sql.ResultSet rs)

getConnection

protected final JdbcConnectionResource getConnection()

getJavaConnection

protected java.sql.Connection getJavaConnection(Env env)
                                         throws java.sql.SQLException
Throws:
java.sql.SQLException

setErrorMessage

protected void setErrorMessage(java.lang.String msg)

setErrorCode

protected void setErrorCode(int code)

isFetchFieldIndexBeforeFieldName

protected boolean isFetchFieldIndexBeforeFieldName()

toString

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