static void getAvailableDrivers(
)
|
|
returns an array of available PDO drivers
API Tags:
the constructor
Parameters:
API Tags:
Redefined in descendants as:
addTable adds a Doctrine_Table object into connection registry
Parameters:
$table |
$table: |
a Doctrine_Table object to be added into registry |
API Tags:
integer beginTransaction(
[string
$savepoint = null]
)
|
|
beginTransaction Start a transaction or set a savepoint.
if trying to set a savepoint and there is no active transaction a new transaction is being started
Listeners: onPreTransactionBegin, onTransactionBegin
Parameters:
string |
$savepoint: |
name of a savepoint to set |
API Tags:
Return: | current transaction nesting level |
Access: | public |
Information Tags:
Throws: | Doctrine_Transaction_Exception if the transaction fails at database level |
clear clears all repositories
API Tags:
close closes the connection
API Tags:
boolean commit(
[string
$savepoint = null]
)
|
|
commit Commit the database changes done during a transaction that is in progress or release a savepoint. This function may only be called when auto-committing is disabled, otherwise it will fail.
Listeners: onPreTransactionCommit, onTransactionCommit
Parameters:
string |
$savepoint: |
name of a savepoint to release |
API Tags:
Return: | false if commit couldn't be performed, true otherwise |
Access: | public |
Information Tags:
Throws: | Doctrine_Validator_Exception if the transaction fails due to record validations |
Throws: | Doctrine_Transaction_Exception if the transaction fails at PDO level |
connect connects into database
API Tags:
Redefined in descendants as:
void convertBooleans(
array
$item
)
|
|
convertBooleans some drivers need the boolean values to be converted into integers when using DQL API
This method takes care of that conversion
Parameters:
API Tags:
Redefined in descendants as:
returns the count of initialized table objects
API Tags:
Implementation of:
- Countable::count
create creates a record
create creates a record
Parameters:
string |
$name: |
component name |
API Tags:
Return: | Doctrine_Record object |
Access: | public |
converts given driver name
Parameters:
API Tags:
errorCode Fetch the SQLSTATE associated with the last operation on the database handle
API Tags:
errorInfo Fetch extended error information associated with the last operation on the database handle
API Tags:
evictTables evicts all tables
API Tags:
exec
Parameters:
string |
$query: |
sql query |
array |
$params: |
query parameters |
API Tags:
execute
Parameters:
string |
$query: |
sql query |
array |
$params: |
query parameters |
API Tags:
array fetchAll(
string
$statement, [
$params = array()]
)
|
|
fetchAll
Parameters:
string |
$statement: |
sql query to be executed |
array |
$params: |
prepared statement params |
API Tags:
array fetchArray(
string
$statement, [
$params = array()]
)
|
|
fetchArray
Parameters:
string |
$statement: |
sql query to be executed |
array |
$params: |
prepared statement params |
API Tags:
array fetchAssoc(
string
$statement, [
$params = array()]
)
|
|
fetchAssoc
Parameters:
string |
$statement: |
sql query to be executed |
array |
$params: |
prepared statement params |
API Tags:
array fetchBoth(
string
$statement, [
$params = array()]
)
|
|
fetchBoth
Parameters:
string |
$statement: |
sql query to be executed |
array |
$params: |
prepared statement params |
API Tags:
array fetchColumn(
string
$statement, [
$params = array()], [int
$colnum = 0]
)
|
|
fetchColumn
Parameters:
string |
$statement: |
sql query to be executed |
array |
$params: |
prepared statement params |
int |
$colnum: |
0-indexed column number to retrieve |
API Tags:
mixed fetchOne(
string
$statement, [
$params = array()], [int
$colnum = 0]
)
|
|
fetchOne
Parameters:
string |
$statement: |
sql query to be executed |
array |
$params: |
prepared statement params |
int |
$colnum: |
0-indexed column number to retrieve |
API Tags:
array fetchRow(
string
$statement, [
$params = array()]
)
|
|
fetchRow
Parameters:
string |
$statement: |
sql query to be executed |
array |
$params: |
prepared statement params |
API Tags:
flush saves all the records from all tables this operation is isolated using a transaction
API Tags:
Information Tags:
Throws: | PDOException if something went wrong at database level |
mixed getAttribute(
integer
$attribute
)
|
|
getAttribute retrieves a database connection attribute
Parameters:
API Tags:
Redefinition of:
- Doctrine_Configurable::getAttribute()
- returns the value of an attribute
returns the database handler of which this connection uses
API Tags:
Return: | the database handler |
Access: | public |
ArrayIterator getIterator(
)
|
|
returns an iterator that iterators through all initialized table objects
foreach ($conn as $index => $table) {
print $table; // get a string representation of each table object
}
API Tags:
Return: | SPL ArrayIterator object |
Access: | public |
Implementation of:
- IteratorAggregate::getIterator
returns the manager that created this connection
API Tags:
getName returns the name of this driver
API Tags:
Return: | the name of this driver |
Access: | public |
returns a table object for given component name
Parameters:
string |
$name: |
component name |
|
$allowExport: |
|
API Tags:
returns an array of all initialized tables
API Tags:
integer getTransactionLevel(
)
|
|
get the current transaction nesting level
API Tags:
boolean hasTable(
mixed
$name
)
|
|
hasTable whether or not this connection has table $name initialized
Parameters:
API Tags:
void incrementQueryCount(
)
|
|
API Tags:
boolean insert(
string
$table, [
$values = array()]
)
|
|
Inserts a table row with specified data.
Parameters:
string |
$table: |
The table to insert data into. |
array |
$values: |
An associateve array containing column-value pairs. |
API Tags:
void lastInsertId(
[string
$table = null], [string
$field = null]
)
|
|
lastInsertId
Returns the ID of the last inserted row, or the last value from a sequence object, depending on the underlying driver.
Note: This method may not return a meaningful or consistent result across different drivers, because the underlying database may not even support the notion of auto-increment fields or sequences.
Parameters:
string |
$table: |
name of the table into which a new row was inserted |
string |
$field: |
name of the field into which a new row was inserted |
API Tags:
void prepare(
string
$statement
)
|
|
prepare
Parameters:
API Tags:
query queries the database using Doctrine Query Language returns a collection of Doctrine_Record objects
$users =
$conn->query('SELECT u.* FROM User u');
$users =
$conn->query('SELECT u.* FROM User u WHERE u.name LIKE ?', array('someone'));
Parameters:
string |
$query: |
DQL query |
array |
$params: |
query parameters |
API Tags:
Return: | Collection of Doctrine_Record objects |
See: | Doctrine_Query |
Access: | public |
query queries the database using Doctrine Query Language and returns the first record found
$user =
$conn->queryOne('SELECT u.* FROM User u WHERE u.id = ?', array(1));
$user =
$conn->queryOne('SELECT u.* FROM User u WHERE u.name LIKE ? AND u.password = ?',
array('someone', 'password')
);
Parameters:
string |
$query: |
DQL query |
array |
$params: |
query parameters |
API Tags:
Return: | Doctrine_Record object on success, boolean false on failure |
See: | Doctrine_Query |
Access: | public |
mixed quote(
mixed
$input, [string
$type = null]
)
|
|
quote quotes given input parameter
Parameters:
mixed |
$input: |
parameter to be quoted |
string |
$type: |
|
API Tags:
string quoteIdentifier(
string
$str, [bool
$checkOption = true]
)
|
|
Quote a string so it can be safely used as a table or column name
Delimiting style depends on which database driver is being used.
NOTE: just because you CAN use delimited identifiers doesn't mean you SHOULD use them. In general, they end up causing way more problems than they solve.
Portability is broken by using the following characters inside delimited identifiers:
- backtick (`) -- due to MySQL
- double quote (") -- due to Oracle
- brackets ([ or ]) -- due to Access
Delimited identifiers are known to generally work correctly under the following drivers: - mssql
- mysql
- mysqli
- oci8
- pgsql
- sqlite
InterBase doesn't seem to be able to use delimited identifiers via PHP 4. They work fine under PHP 5.
Parameters:
string |
$str: |
identifier name to be quoted |
bool |
$checkOption: |
check the 'quote_identifier' option |
API Tags:
Return: | quoted identifier string |
Access: | public |
Redefined in descendants as:
integer replace(
string
$table,
$fields,
$keys
)
|
|
Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT query, except that if there is already a row in the table with the same key field values, the REPLACE query just updates its values instead of inserting a new row.
The REPLACE type of query does not make part of the SQL standards. Since practically only MySQL and SQLIte implement it natively, this type of query isemulated through this method for other DBMS using standard types of queries inside a transaction to assure the atomicity of the operation.
Parameters:
array |
$keys: |
an array containing all key fields (primary key fields or unique index fields) for this table the uniqueness of a row will be determined according to the provided key fields this method will fail if no key fields are specified |
string |
$table: |
name of the table on which the REPLACE query will be executed. |
array |
$fields: |
an associative array that describes the fields and the values that will be inserted or updated in the specified table. The indexes of the array are the names of all the fields of the table. The values of the array are values to be assigned to the specified field. |
API Tags:
Return: | number of rows affected |
Access: | public |
Information Tags:
Throws: | Doctrine_Connection_Exception if this driver doesn't support replace |
Throws: | PDOException if something fails at PDO level |
Throws: | Doctrine_Connection_Exception if some of the key values was null |
Throws: | Doctrine_Connection_Exception if there were no key fields |
Redefined in descendants as:
-
Doctrine_Connection_Mysql::replace()
: Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT query, except that if there is already a row in the table with the same key field values, the REPLACE query just updates its values instead of inserting a new row.
void rethrowException(
$e,
$invoker
)
|
|
rethrowException
Parameters:
API Tags:
Information Tags:
Throws: | Doctrine_Connection_Exception |
boolean rollback(
[string
$savepoint = null]
)
|
|
rollback
Cancel any database changes done during a transaction or since a specific savepoint that is in progress. This function may only be called when auto-committing is disabled, otherwise it will fail. Therefore, a new transaction is implicitly started after canceling the pending changes.
this method can be listened with onPreTransactionRollback and onTransactionRollback eventlistener methods
Parameters:
string |
$savepoint: |
name of a savepoint to rollback to |
API Tags:
Return: | false if rollback couldn't be performed, true otherwise |
Access: | public |
Information Tags:
Throws: | Doctrine_Transaction_Exception if the rollback operation fails at database level |
PDOStatement select(
string
$query, [integer
$limit = 0], [integer
$offset = 0]
)
|
|
queries the database with limit and offset added to the query and returns a PDOStatement object
Parameters:
string |
$query: |
|
integer |
$limit: |
|
integer |
$offset: |
|
API Tags:
boolean setAttribute(
integer
$attribute, mixed
$value
)
|
|
setAttribute sets an attribute
Parameters:
integer |
$attribute: |
|
mixed |
$value: |
|
API Tags:
Redefinition of:
- Doctrine_Configurable::setAttribute()
- setAttribute sets a given attribute
void setCharset(
string
$charset
)
|
|
Set the charset on the current connection
Parameters:
API Tags:
Redefined in descendants as:
void setDateFormat(
[string
$format = null]
)
|
|
Set the date/time format for the current connection
Parameters:
string |
$format: |
time format |
API Tags:
Redefined in descendants as:
standaloneQuery
Parameters:
string |
$query: |
sql query |
array |
$params: |
query parameters |
API Tags:
boolean supports(
string
$feature
)
|
|
supports
Parameters:
string |
$feature: |
the name of the feature |
API Tags:
Return: | whether or not this drivers supports given feature |
Access: | public |
__get lazy loads given module and returns it
Parameters:
string |
$name: |
the name of the module to get |
API Tags:
Information Tags:
Throws: | Doctrine_Connection_Exception if trying to get an unknown module |
returns a string representation of this object
API Tags: