Public Member Functions | |
getConnection () | |
Gets the db Connection that created this statement. | |
getResource () | |
Get the PHP native resource for the statement (if supported). | |
close () | |
Free resources associated with this statement. | |
getResultSet () | |
Get result set. | |
getMoreResults () | |
Gets next result set (if this behavior is supported by driver). | |
getUpdateCount () | |
Get update count. | |
setLimit ($v) | |
Sets the maximum number of rows to return from db. | |
getLimit () | |
Returns the maximum number of rows to return or 0 for all. | |
setOffset ($v) | |
Sets the start row. | |
getOffset () | |
Returns the start row. | |
executeQuery () | |
Executes the SQL query in this PreparedStatement object and returns the resultset generated by the query. | |
executeUpdate ($params=null) | |
Executes the SQL INSERT, UPDATE, or DELETE statement in this PreparedStatement object. | |
set ($paramIndex, $value) | |
A generic set method. | |
setArray ($paramIndex, $value) | |
Sets an array. | |
setBoolean ($paramIndex, $value) | |
Sets a boolean value. | |
setBlob ($paramIndex, $blob) | |
setClob ($paramIndex, $clob) | |
setDate ($paramIndex, $value) | |
setFloat ($paramIndex, $value) | |
setInt ($paramIndex, $value) | |
setNull ($paramIndex) | |
setString ($paramIndex, $value) | |
setTime ($paramIndex, $value) | |
setTimestamp ($paramIndex, $value) |
Definition at line 50 of file PreparedStatement.php.
PreparedStatement::close | ( | ) |
Free resources associated with this statement.
Some drivers will need to implement this method to free database result resources.
Implemented in MSSQLCallableStatement, and OCI8PreparedStatement.
PreparedStatement::executeQuery | ( | ) |
Executes the SQL query in this PreparedStatement object and returns the resultset generated by the query.
We support two signatures for this method:
mixed | $p1 Either (array) Parameters that will be set using PreparedStatement::set() before query is executed or (int) fetchmode. | |
int | $fetchmode The mode to use when fetching the results (e.g. ResultSet::FETCHMODE_NUM, ResultSet::FETCHMODE_ASSOC). |
SQLException | if a database access error occurs. |
Implemented in ODBCPreparedStatement.
PreparedStatement::executeUpdate | ( | $ | params = null |
) |
Executes the SQL INSERT, UPDATE, or DELETE statement in this PreparedStatement object.
array | $params Parameters that will be set using PreparedStatement::set() before query is executed. |
SQLException | if a database access error occurs. |
Implemented in ODBCPreparedStatement, and OCI8PreparedStatement.
PreparedStatement::getConnection | ( | ) |
PreparedStatement::getLimit | ( | ) |
Returns the maximum number of rows to return or 0 for all.
PreparedStatement::getMoreResults | ( | ) |
Gets next result set (if this behavior is supported by driver).
Some drivers (e.g. MSSQL) support returning multiple result sets -- e.g. from stored procedures.
This function also closes any current restult set.
Default behavior is for this function to return false. Driver-specific implementations of this class can override this method if they actually support multiple result sets.
Implemented in MSSQLCallableStatement.
PreparedStatement::getOffset | ( | ) |
Returns the start row.
Offset only applies when Limit is set!
PreparedStatement::getResource | ( | ) |
Get the PHP native resource for the statement (if supported).
Implemented in MSSQLCallableStatement.
PreparedStatement::getResultSet | ( | ) |
Get result set.
This assumes that the last thing done was an executeQuery() or an execute() with SELECT-type query.
null
if not applicable. PreparedStatement::getUpdateCount | ( | ) |
Get update count.
null
if not applicable. PreparedStatement::set | ( | $ | paramIndex, | |
$ | value | |||
) |
A generic set method.
You can use this if you don't want to concern yourself with the details. It involves slightly more overhead than the specific settesr, since it grabs the PHP type to determine which method makes most sense.
int | $paramIndex | |
mixed | $value |
SQLException |
PreparedStatement::setArray | ( | $ | paramIndex, | |
$ | value | |||
) |
Sets an array.
Unless a driver-specific method is used, this means simply serializing the passed parameter and storing it as a string.
int | $paramIndex | |
array | $value |
Implemented in PgSQLPreparedStatement.
PreparedStatement::setBlob | ( | $ | paramIndex, | |
$ | blob | |||
) |
int | $paramIndex | |
mixed | $blob Blob object or string containing data. |
Implemented in MSSQLPreparedStatement, ODBCPreparedStatement, OCI8PreparedStatement, PgSQLPreparedStatement, and SQLitePreparedStatement.
PreparedStatement::setBoolean | ( | $ | paramIndex, | |
$ | value | |||
) |
Sets a boolean value.
Default behavior is true = 1, false = 0.
int | $paramIndex | |
boolean | $value |
Implemented in PgSQLPreparedStatement.
PreparedStatement::setClob | ( | $ | paramIndex, | |
$ | clob | |||
) |
int | $paramIndex | |
mixed | $clob Clob object or string containing data. |
Implemented in ODBCPreparedStatement, and OCI8PreparedStatement.
PreparedStatement::setDate | ( | $ | paramIndex, | |
$ | value | |||
) |
PreparedStatement::setFloat | ( | $ | paramIndex, | |
$ | value | |||
) |
int | $paramIndex | |
float | $value |
PreparedStatement::setInt | ( | $ | paramIndex, | |
$ | value | |||
) |
int | $paramIndex | |
int | $value |
PreparedStatement::setLimit | ( | $ | v | ) |
Sets the maximum number of rows to return from db.
This will affect the SQL if the RDBMS supports native LIMIT; if not, it will be emulated. Limit only applies to queries (not update sql).
int | $v Maximum number of rows or 0 for all rows. |
PreparedStatement::setNull | ( | $ | paramIndex | ) |
int | $paramIndex |
Implemented in MSSQLCallableStatement, ODBCPreparedStatement, and OCI8PreparedStatement.
PreparedStatement::setOffset | ( | $ | v | ) |
Sets the start row.
This will affect the SQL if the RDBMS supports native OFFSET; if not, it will be emulated. Offset only applies to queries (not update) and only is evaluated when LIMIT is set!
int | $v |
PreparedStatement::setString | ( | $ | paramIndex, | |
$ | value | |||
) |
PreparedStatement::setTime | ( | $ | paramIndex, | |
$ | value | |||
) |
PreparedStatement::setTimestamp | ( | $ | paramIndex, | |
$ | value | |||
) |
int | $paramIndex | |
string | $value |
Implemented in OCI8PreparedStatement, and PgSQLPreparedStatement.