[ Index ]
 

Code source de Symfony 1.0.0

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

title

Body

[fermer]

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

(pas de description)

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

Définit 1 class

Connection:: (20 méthodes):
  connect()
  getResource()
  getFlags()
  getDSN()
  getDatabaseInfo()
  getIdGenerator()
  prepareStatement()
  createStatement()
  applyLimit()
  executeQuery()
  executeUpdate()
  prepareCall()
  close()
  isConnected()
  getAutoCommit()
  setAutoCommit()
  begin()
  commit()
  rollback()
  getUpdateCount()


Interface: Connection  - X-Ref

Connection is an abstract base class for DB dialect implementations, and must be
inherited by all such.

Developer notes:
(1) Make sure that your Connection class can be serialized.  See the ConnectionCommon __sleep() and __wakeup() implimentation.

connect($dsn, $flags = false)   X-Ref
Connect to a database and log in as the specified user.

param: array $dsn The PEAR-style data source hash.
param: int $flags (optional) Flags for connection (e.g. Creole::PERSISTENT).  These flags

getResource()   X-Ref
Get the PHP native resource for the database connection/link.

return: resource

getFlags()   X-Ref
Get any flags that were passed to connection.

return: int

getDSN()   X-Ref
Get the DSN array used by connect() method to connect to database.

return: array

getDatabaseInfo()   X-Ref
Gets a DatabaseInfo class for the current database.

This is not modeled on the JDBC MetaData class, but provides a possibly more
useful metadata system.  All the same, there may eventually be a getMetaData()
which returns a class that behaves like JDBC's DatabaseMetaData.

return: DatabaseInfo

getIdGenerator()   X-Ref
Loads and returns an IdGenerator object for current RDBMS.

return: IdGenerator

prepareStatement($sql)   X-Ref
Prepares a query for multiple execution with execute().

With some database backends, this is emulated.
prepare() requires a generic query as string like
"INSERT INTO numbers VALUES(?,?,?)". The ? are placeholders.

IMPORTANT:  All occurrences of the placeholder (?) will be assumed
to be a parameter.  Therefore be sure not to have ? anywhere else in
the query.

So, ... DO NOT MIX WILDCARDS WITH ALREADY-PREPARED QUERIES

INCORRECT:
SELECT * FROM mytable WHERE id = ? AND title = 'Where are you?' and body LIKE ?

CORRECT:
SELECT * FROM mytable WHERE id = ? AND title = ? and body LIKE ?

param: string $sql The query to prepare.
return: PreparedStatement

createStatement()   X-Ref
Creates a new empty Statement.

return: Statement

applyLimit(&$sql, $offset, $limit)   X-Ref
If RDBMS supports native LIMIT/OFFSET then query SQL is modified
so that no emulation is performed in ResultSet.

param: string &$sql The query that will be modified.
param: int $offset
param: int $limit
return: void

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

param: string $sql The SQL statement.
param: int $fetchmode
return: object ResultSet

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

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

prepareCall($sql)   X-Ref
Creates a CallableStatement object for calling database stored procedures.

param: string $sql
return: CallableStatement

close()   X-Ref
Free the db resources.

return: void

isConnected()   X-Ref
Returns false if connection is closed.

return: boolean

getAutoCommit()   X-Ref
Get auto-commit status.

return: boolean

setAutoCommit($bit)   X-Ref
Enable/disable automatic commits.

Pushes SQLWarning onto $warnings stack if the autocommit value is being changed mid-transaction. This function
is overridden by driver classes so that they can perform the necessary begin/end transaction SQL.

If auto-commit is being set to TRUE, then the current transaction will be committed immediately.

param: boolean $bit New value for auto commit.
return: void

begin()   X-Ref
Begins a transaction (if supported).


commit()   X-Ref
Commits statements in a transaction.


rollback()   X-Ref
Rollback changes in a transaction.


getUpdateCount()   X-Ref
Gets the number of rows affected by the data manipulation
query.

return: int Number of rows affected by the last query.



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