[ Index ]
 

Code source de Symfony 1.0.0

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

title

Body

[fermer]

/lib/vendor/creole/common/ -> StatementCommon.php (sommaire)

Class that contains common/shared functionality for Statements.

Author: Hans Lellelid <hans@xmpl.org>
Version: $Revision: 1.4 $
Poids: 289 lignes (9 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 14 fonctions

  __construct()
  setLimit()
  getLimit()
  setOffset()
  getOffset()
  close()
  execute()
  getResultSet()
  getUpdateCount()
  isSelect()
  executeQuery()
  executeUpdate()
  getMoreResults()
  getConnection()

Fonctions
Fonctions qui ne font pas partie d'une Classe:

__construct(Connection $conn)   X-Ref
Create new statement instance.

param: Connection $conn Connection object

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

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

return: void

execute($sql, $fetchmode = null)   X-Ref
Generic execute() function has to check to see whether SQL is an update or select query.

If you already know whether it's a SELECT or an update (manipulating) SQL, then use
the appropriate method, as this one will incurr overhead to check the SQL.

param: int $fetchmode Fetchmode (only applies to queries).
return: boolean True if it is a result set, false if not or if no more results (this is identical to JDBC return val).

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 (or null if none)

getUpdateCount()   X-Ref
Get update count.

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

isSelect($sql)   X-Ref
Returns whether the passed SQL is a SELECT statement.

Returns true if SQL starts with 'SELECT' but not 'SELECT INTO'.  This exists
to support the execute() function -- which could either execute an update or
a query.

Currently this function does not take into consideration comments, primarily
because there are a number of different comment options for different drivers:
<pre>
-- SQL-defined comment, but not truly comment in Oracle
# comment in mysql
/* comment in mssql, others * /
// comment sometimes?
REM also comment ...
</pre>

If you're wondering why we can't just execute the query and look at the return results
to see whether it was an update or a select, the reason is that for update queries we
need to do stuff before we execute them -- like start transactions if auto-commit is off.

param: string $sql
return: boolean Whether statement is a SELECT SQL statement.

executeQuery($sql, $fetchmode = null)   X-Ref
Executes the SQL query in this PreparedStatement object and returns the resultset generated by the query.

param: string $sql This method may optionally be called with the SQL statement.
param: int $fetchmode The mode to use when fetching the results (e.g. ResultSet::FETCHMODE_NUM, ResultSet::FETCHMODE_ASSOC).
return: object Creole::ResultSet

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

param: string $sql This method may optionally be called with the SQL statement.
return: int Number of affected rows (or 0 for drivers that return nothing).

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.

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

return: Connection



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