[ Index ]
 

Code source de Symfony 1.0.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/vendor/creole/ -> PreparedStatement.php (sommaire)

(pas de description)

Poids: 253 lignes (9 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

PreparedStatement:: (24 méthodes):
  getConnection()
  getResource()
  close()
  getResultSet()
  getMoreResults()
  getUpdateCount()
  setLimit()
  getLimit()
  setOffset()
  getOffset()
  executeQuery()
  executeUpdate()
  set()
  setArray()
  setBoolean()
  setBlob()
  setClob()
  setDate()
  setFloat()
  setInt()
  setNull()
  setString()
  setTime()
  setTimestamp()


Interface: PreparedStatement  - X-Ref

Interface for a pre-compiled SQL statement.

Many drivers do not take advantage of pre-compiling SQL statements; for these
cases the precompilation is emulated.  This emulation comes with slight penalty involved
in parsing the queries, but provides other benefits such as a cleaner object model and ability
to work with BLOB and CLOB values w/o needing special LOB-specific routines.

This class is abstract because there are driver-specific implementations in [clearly] how queries
are executed, and how parameters are bound.

This class is not as abstract as the JDBC version.  For exmple, if you are using a driver
that uses name-based query param substitution, then you'd better bind your variables to
names rather than index numbers.  e.g. in Oracle
<code>
$stmt = $conn->prepareStatement("INSERT INTO users (name, passwd) VALUES (:name, :pass)");
$stmt->setString(":name", $name);
$stmt->executeUpdate();
</code>

Developer note:  In many ways this interface is an extension of the Statement interface.  However, due
to limitations in PHP5's interface extension model (specifically that you cannot change signatures on
methods defined in parent interface), we cannot extend the Statement interface.

getConnection()   X-Ref
Gets the db Connection that created this statement.

return: Connection

getResource()   X-Ref
Get the PHP native resource for the statement (if supported).

return: resource

close()   X-Ref
Free resources associated with this statement.
Some drivers will need to implement this method to free
database result resources.

return: void

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

return: RestultSet Last ResultSet or <code>null</code> if not applicable.

getMoreResults()   X-Ref
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.

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

getUpdateCount()   X-Ref
Get update count.

return: int Number of records affected, or <code>null</code> if not applicable.

setLimit($v)   X-Ref
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).

param: int $v Maximum number of rows or 0 for all rows.
return: void

getLimit()   X-Ref
Returns the maximum number of rows to return or 0 for all.

return: int

setOffset($v)   X-Ref
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!

param: int $v
return: void

getOffset()   X-Ref
Returns the start row.
Offset only applies when Limit is set!

return: int

executeQuery()   X-Ref
Executes the SQL query in this PreparedStatement object and returns the resultset generated by the query.
We support two signatures for this method:
- $stmt->executeQuery(ResultSet::FETCHMODE_NUM);
- $stmt->executeQuery(array($param1, $param2), ResultSet::FETCHMODE_NUM);

param: mixed $p1 Either (array) Parameters that will be set using PreparedStatement::set() before query is executed or (int) fetchmode.
param: int $fetchmode The mode to use when fetching the results (e.g. ResultSet::FETCHMODE_NUM, ResultSet::FETCHMODE_ASSOC).
return: ResultSet

executeUpdate($params = null)   X-Ref
Executes the SQL INSERT, UPDATE, or DELETE statement in this PreparedStatement object.

param: array $params Parameters that will be set using PreparedStatement::set() before query is executed.
return: int Number of affected rows (or 0 for drivers that return nothing).

set($paramIndex, $value)   X-Ref
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.

param: int $paramIndex
param: mixed $value
return: void

setArray($paramIndex, $value)   X-Ref
Sets an array.
Unless a driver-specific method is used, this means simply serializing
the passed parameter and storing it as a string.

param: int $paramIndex
param: array $value
return: void

setBoolean($paramIndex, $value)   X-Ref
Sets a boolean value.
Default behavior is true = 1, false = 0.

param: int $paramIndex
param: boolean $value
return: void

setBlob($paramIndex, $blob)   X-Ref

param: int $paramIndex
param: mixed $blob Blob object or string containing data.
return: void

setClob($paramIndex, $clob)   X-Ref

param: int $paramIndex
param: mixed $clob Clob object  or string containing data.
return: void

setDate($paramIndex, $value)   X-Ref

param: int $paramIndex
param: string $value
return: void

setFloat($paramIndex, $value)   X-Ref

param: int $paramIndex
param: float $value
return: void

setInt($paramIndex, $value)   X-Ref

param: int $paramIndex
param: int $value
return: void

setNull($paramIndex)   X-Ref

param: int $paramIndex
return: void

setString($paramIndex, $value)   X-Ref

param: int $paramIndex
param: string $value
return: void

setTime($paramIndex, $value)   X-Ref

param: int $paramIndex
param: string $value
return: void

setTimestamp($paramIndex, $value)   X-Ref

param: int $paramIndex
param: string $value
return: void



Généré le : Fri Mar 16 22:42:14 2007 par Balluche grâce à PHPXref 0.7