PreparedStatement Interface Reference

Inherited by CallableStatement, MSSQLPreparedStatement, MySQLPreparedStatement, OCI8PreparedStatement, PgSQLPreparedStatement, and SQLitePreparedStatement.

List of all members.

Public Member Functions


Member Function Documentation

Connection PreparedStatement::getConnection ( )

 

Gets the db Connection that created this statement.
Returns Connection

resource PreparedStatement::getResource ( )

 

Get the PHP native resource for the statement (if supported).
Returns resource

Implemented in MSSQLCallableStatement.

void PreparedStatement::close ( )

 

Free resources associated with this statement. Some drivers will need to implement this method to free database result resources.

Returns void

Implemented in MSSQLCallableStatement, and OCI8PreparedStatement.

RestultSet PreparedStatement::getResultSet ( )

 

Get result set. This assumes that the last thing done was an executeQuery() or an execute() with SELECT-type query.

Returns RestultSet Last ResultSet or null if not applicable.

boolean 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.

Returns boolean True if there is another result set, otherwise false.

Implemented in MSSQLCallableStatement.

int PreparedStatement::getUpdateCount ( )

 

Get update count.

Returns int Number of records affected, or null if not applicable.

void 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).
Parameters
int $v Maximum number of rows or 0 for all rows.

Returns void

int PreparedStatement::getLimit ( )

 

Returns the maximum number of rows to return or 0 for all.
Returns int

void 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!
Parameters
int $v

Returns void

int PreparedStatement::getOffset ( )

 

Returns the start row. Offset only applies when Limit is set!
Returns int

ResultSet PreparedStatement::executeQuery ( $ p1 = null, $ fetchmode = null )

 

Executes the SQL query in this PreparedStatement object and returns the resultset generated by the query. We support two signatures for this method:

Implemented in MSSQLCallableStatement, MSSQLPreparedStatement, and OCI8PreparedStatement.

int PreparedStatement::executeUpdate ( $ params = null )

 

Executes the SQL INSERT, UPDATE, or DELETE statement in this PreparedStatement object.

Parameters
array $params Parameters that will be set using PreparedStatement::set() before query is executed.

Returns int Number of affected rows (or 0 for drivers that return nothing).
Exceptions
SQLException if a database access error occurs.

Implemented in OCI8PreparedStatement.

void 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.

Parameters
int $paramIndex
mixed $value

Returns void
Exceptions
SQLException 

void 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.
Parameters
int $paramIndex
array $value

Returns void

Implemented in PgSQLPreparedStatement.

void PreparedStatement::setBoolean ( $ paramIndex, $ value )

 

Sets a boolean value. Default behavior is true = 1, false = 0.
Parameters
int $paramIndex
boolean $value

Returns void

Implemented in PgSQLPreparedStatement.

void PreparedStatement::setBlob ( $ paramIndex, $ blob )

 

Parameters
int $paramIndex
mixed $blob Blob object or string containing data.

Returns void

Implemented in MSSQLPreparedStatement, OCI8PreparedStatement, PgSQLPreparedStatement, and SQLitePreparedStatement.

void PreparedStatement::setClob ( $ paramIndex, $ clob )

 

Parameters
int $paramIndex
mixed $clob Clob object or string containing data.

Returns void

Implemented in OCI8PreparedStatement.

void PreparedStatement::setDate ( $ paramIndex, $ value )

 

Parameters
int $paramIndex
string $value

Returns void

void PreparedStatement::setFloat ( $ paramIndex, $ value )

 

Parameters
int $paramIndex
float $value

Returns void

void PreparedStatement::setInt ( $ paramIndex, $ value )

 

Parameters
int $paramIndex
int $value

Returns void

void PreparedStatement::setNull ( $ paramIndex )

 

Parameters
int $paramIndex

Returns void

Implemented in MSSQLCallableStatement.

void PreparedStatement::setString ( $ paramIndex, $ value )

 

Parameters
int $paramIndex
string $value

Returns void

void PreparedStatement::setTime ( $ paramIndex, $ value )

 

Parameters
int $paramIndex
string $value

Returns void

void PreparedStatement::setTimestamp ( $ paramIndex, $ value )

 

Parameters
int $paramIndex
string $value

Returns void


This file is part of the Creole[php5] library.


Copyright © 2004 Hans Lellelid  
Creole[php5] CVS