com.caucho.quercus.lib.db
Class PDOStatement

java.lang.Object
  extended by com.caucho.quercus.lib.db.JdbcStatementResource
      extended by com.caucho.quercus.lib.db.JdbcPreparedStatementResource
          extended by com.caucho.quercus.lib.db.PDOStatement
All Implemented Interfaces:
EnvCleanup, java.lang.Iterable<Value>

public class PDOStatement
extends JdbcPreparedStatementResource
implements java.lang.Iterable<Value>, EnvCleanup

PDO object oriented API facade.


Field Summary
 java.lang.String queryString
           
 
Constructor Summary
protected PDOStatement(Env env, PDO pdo, PDOError error, java.lang.String query, boolean isPrepared, ArrayValue options, boolean isCatchException)
           
 
Method Summary
 boolean bindColumn(Env env, Value column, Value var, int type)
           
 boolean bindParam(Env env, Value parameter, Value value, int dataType, int length, Value driverOptions)
           
 boolean bindValue(Env env, Value parameter, Value value, int dataType)
           
 void cleanup()
          Implements the EnvCleanup interface.
 boolean close()
          Closes the result set, if any, and closes this statement.
 boolean closeCursor(Env env)
          Closes the current cursor.
 int columnCount(Env env)
          Returns the number of columns.
protected  JdbcResultResource createResultSet(java.sql.ResultSet rs)
           
 java.lang.String errorCode(Env env)
           
 ArrayValue errorInfo()
           
 boolean execute(Env env, Value inputParameters)
          Execute the statement.
protected  boolean executeImpl(Env env)
           
 Value fetch(Env env, int fetchMode, int cursorOrientation, int cursorOffset)
          Fetch the next row.
 Value fetchAll(Env env, int fetchMode, int columnIndex)
           
 Value fetchColumn(Env env, int column)
           
 Value fetchObject(Env env, java.lang.String className, Value[] args)
           
 Value getAttribute(Env env, int attribute)
           
 Value getColumnMeta(Env env, int column)
           
protected  boolean isFetchFieldIndexBeforeFieldName()
           
 java.util.Iterator<Value> iterator()
          Returns an iterator of the values.
 boolean nextRowset()
           
 int rowCount(Env env)
           
 boolean setAttribute(Env env, int attribute, Value value)
           
 boolean setAttribute(Env env, int attribute, Value value, boolean isFromConstructor)
           
protected  void setError(Env env, java.sql.SQLException e)
           
 boolean setFetchMode(Env env, int fetchMode, Value[] args)
          Sets the fetch mode, the default is PDO.FETCH_BOTH.
 java.lang.String toString()
           
 
Methods inherited from class com.caucho.quercus.lib.db.JdbcPreparedStatementResource
bindParams, getParam, getParamLength, getPreparedStatement, isPreparable, paramCount, prepare, prepareForExecute, setObject, setPreparedStatement
 
Methods inherited from class com.caucho.quercus.lib.db.JdbcStatementResource
bindResults, dataSeek, execute, execute, fetch, freeResult, getColumnCount, getConnection, getErrorCode, getErrorMessage, getFieldCount, getJavaConnection, getMetaData, getNumRows, getQuery, getResultSet, getStatementType, lastInsertId, setErrorCode, setErrorMessage, setQuery, setResultSet, setStatement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

queryString

public final java.lang.String queryString
Constructor Detail

PDOStatement

protected PDOStatement(Env env,
                       PDO pdo,
                       PDOError error,
                       java.lang.String query,
                       boolean isPrepared,
                       ArrayValue options,
                       boolean isCatchException)
                throws java.sql.SQLException
Throws:
java.sql.SQLException
Method Detail

bindColumn

public boolean bindColumn(Env env,
                          Value column,
                          Value var,
                          int type)

bindParam

public boolean bindParam(Env env,
                         Value parameter,
                         Value value,
                         int dataType,
                         int length,
                         Value driverOptions)

bindValue

public boolean bindValue(Env env,
                         Value parameter,
                         Value value,
                         int dataType)

closeCursor

public boolean closeCursor(Env env)
Closes the current cursor.


columnCount

public int columnCount(Env env)
Returns the number of columns.


close

public boolean close()
Description copied from class: JdbcStatementResource
Closes the result set, if any, and closes this statement.

Overrides:
close in class JdbcStatementResource

cleanup

public void cleanup()
Implements the EnvCleanup interface.

Specified by:
cleanup in interface EnvCleanup

errorCode

public java.lang.String errorCode(Env env)

errorInfo

public ArrayValue errorInfo()

setError

protected void setError(Env env,
                        java.sql.SQLException e)
Overrides:
setError in class JdbcStatementResource

execute

public boolean execute(Env env,
                       Value inputParameters)
Execute the statement.

Parameters:
inputParameters - an array containing input values to correspond to the bound parameters for the statement.
Returns:
true for success, false for failure

executeImpl

protected boolean executeImpl(Env env)
                       throws java.sql.SQLException
Overrides:
executeImpl in class JdbcPreparedStatementResource
Throws:
java.sql.SQLException

createResultSet

protected JdbcResultResource createResultSet(java.sql.ResultSet rs)
Overrides:
createResultSet in class JdbcStatementResource

fetch

public Value fetch(Env env,
                   int fetchMode,
                   int cursorOrientation,
                   int cursorOffset)
Fetch the next row.

Parameters:
fetchMode - the mode, 0 to use the value set by setFetchMode(com.caucho.quercus.env.Env, int, com.caucho.quercus.env.Value[]).
Returns:
a value, BooleanValue.FALSE if there are no more rows or an error occurs.

fetchAll

public Value fetchAll(Env env,
                      int fetchMode,
                      int columnIndex)
Parameters:
fetchMode -
columnIndex - 0-based column index when fetchMode is FETCH_BOTH

fetchColumn

public Value fetchColumn(Env env,
                         int column)
Parameters:
column - 0-based column number

fetchObject

public Value fetchObject(Env env,
                         java.lang.String className,
                         Value[] args)

getAttribute

public Value getAttribute(Env env,
                          int attribute)

getColumnMeta

public Value getColumnMeta(Env env,
                           int column)
Parameters:
column - 0-based column index

iterator

public java.util.Iterator<Value> iterator()
Returns an iterator of the values.

Specified by:
iterator in interface java.lang.Iterable<Value>

nextRowset

public boolean nextRowset()

rowCount

public int rowCount(Env env)

setAttribute

public boolean setAttribute(Env env,
                            int attribute,
                            Value value)

setAttribute

public boolean setAttribute(Env env,
                            int attribute,
                            Value value,
                            boolean isFromConstructor)

setFetchMode

public boolean setFetchMode(Env env,
                            int fetchMode,
                            Value[] args)
Sets the fetch mode, the default is PDO.FETCH_BOTH.


isFetchFieldIndexBeforeFieldName

protected boolean isFetchFieldIndexBeforeFieldName()
Overrides:
isFetchFieldIndexBeforeFieldName in class JdbcStatementResource

toString

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