PreparedStatement Interface Reference

Inheritance diagram for PreparedStatement:

CallableStatement MSSQLPreparedStatement MySQLiPreparedStatement MySQLPreparedStatement OCI8PreparedStatement ODBCPreparedStatement PgSQLPreparedStatement SQLitePreparedStatement

List of all members.

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)


Detailed Description

Definition at line 50 of file PreparedStatement.php.


Member Function Documentation

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.

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:

Implemented in ODBCPreparedStatement.

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 ODBCPreparedStatement, and OCI8PreparedStatement.

PreparedStatement::getConnection (  ) 

Gets the db Connection that created this statement.

Returns:
Connection

PreparedStatement::getLimit (  ) 

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

Returns:
int

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.

PreparedStatement::getOffset (  ) 

Returns the start row.

Offset only applies when Limit is set!

Returns:
int

PreparedStatement::getResource (  ) 

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

Returns:
resource

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.

Returns:
RestultSet Last ResultSet or null if not applicable.

PreparedStatement::getUpdateCount (  ) 

Get update count.

Returns:
int Number of records affected, or 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.

Parameters:
int $paramIndex
mixed $value
Returns:
void
Exceptions:
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.

Parameters:
int $paramIndex
array $value
Returns:
void

Implemented in PgSQLPreparedStatement.

PreparedStatement::setBlob ( paramIndex,
blob 
)

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

Implemented in MSSQLPreparedStatement, ODBCPreparedStatement, OCI8PreparedStatement, PgSQLPreparedStatement, and SQLitePreparedStatement.

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.

PreparedStatement::setClob ( paramIndex,
clob 
)

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

Implemented in ODBCPreparedStatement, and OCI8PreparedStatement.

PreparedStatement::setDate ( paramIndex,
value 
)

Parameters:
int $paramIndex
string $value
Returns:
void

Implemented in OCI8PreparedStatement.

PreparedStatement::setFloat ( paramIndex,
value 
)

Parameters:
int $paramIndex
float $value
Returns:
void

PreparedStatement::setInt ( paramIndex,
value 
)

Parameters:
int $paramIndex
int $value
Returns:
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

PreparedStatement::setNull ( paramIndex  ) 

Parameters:
int $paramIndex
Returns:
void

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!

Parameters:
int $v
Returns:
void

PreparedStatement::setString ( paramIndex,
value 
)

Parameters:
int $paramIndex
string $value
Returns:
void

Implemented in OCI8PreparedStatement.

PreparedStatement::setTime ( paramIndex,
value 
)

Parameters:
int $paramIndex
string $value
Returns:
void

Implemented in PgSQLPreparedStatement.

PreparedStatement::setTimestamp ( paramIndex,
value 
)

Parameters:
int $paramIndex
string $value
Returns:
void

Implemented in OCI8PreparedStatement, and PgSQLPreparedStatement.


The documentation for this interface was generated from the following file:

Generated on Wed May 6 23:10:50 2009 for fareofficelib by  doxygen 1.5.8