Classes:
Doctrine
Doctrine_Access
Doctrine_Adapter
Doctrine_Adapter_Db2_Exception
Doctrine_Adapter_Exception
Doctrine_Adapter_Statement
Doctrine_AuditLog
Doctrine_AuditLog_Listener
Doctrine_Collection
Doctrine_Collection_Exception
Doctrine_Collection_Iterator
Doctrine_Collection_Iterator_Expandable
Doctrine_Collection_Iterator_Normal
Doctrine_Collection_Iterator_Offset
Doctrine_Collection_Offset
Doctrine_Column
Doctrine_Compiler
Doctrine_Compiler_Exception
Doctrine_Configurable
Doctrine_Connection
Doctrine_Connection_Common
Doctrine_Connection_Db2
Doctrine_Connection_Exception
Doctrine_Connection_Firebird
Doctrine_Connection_Firebird_Exception
Doctrine_Connection_Informix
Doctrine_Connection_Informix_Exception
Doctrine_Connection_Mock
Doctrine_Connection_Module
Doctrine_Connection_Mssql
Doctrine_Connection_Mssql_Exception
Doctrine_Connection_Mysql
Doctrine_Connection_Mysql_Exception
Doctrine_Connection_Oracle
Doctrine_Connection_Oracle_Exception
Doctrine_Connection_Pgsql
Doctrine_Connection_Pgsql_Exception
Doctrine_Connection_Profiler
Doctrine_Connection_Profiler_Exception
Doctrine_Connection_Sqlite
Doctrine_Connection_Sqlite_Exception
Doctrine_Connection_Statement
Doctrine_Connection_UnitOfWork
Doctrine_DataDict
Doctrine_DataDict_Exception
Doctrine_DataDict_Informix
Doctrine_DataType
Doctrine_Db
Doctrine_Event
Doctrine_EventListener
Doctrine_EventListener_Chain
Doctrine_EventListener_Exception
Doctrine_Exception
Doctrine_Export
Doctrine_Export_Exception
Doctrine_Export_Firebird
Doctrine_Export_Frontbase
Doctrine_Export_Mssql
Doctrine_Export_Mysql
Doctrine_Export_Oracle
Doctrine_Export_Pgsql
Doctrine_Export_Reporter
Doctrine_Export_Schema
Doctrine_Export_Schema_Xml
Doctrine_Export_Schema_Yml
Doctrine_Export_Sqlite
Doctrine_Expression
Doctrine_Expression_Driver
Doctrine_Expression_Exception
Doctrine_Expression_Firebird
Doctrine_Expression_Informix
Doctrine_Expression_Mock
Doctrine_Expression_Mssql
Doctrine_Expression_Mysql
Doctrine_Expression_Oracle
Doctrine_Expression_Pgsql
Doctrine_Expression_Sqlite
Doctrine_File
Doctrine_File_Index
Doctrine_Formatter
Doctrine_Hook
Doctrine_Hook_Equal
Doctrine_Hook_Integer
Doctrine_Hook_Parser
Doctrine_Hook_Parser_Complex
Doctrine_Hook_WordLike
Doctrine_Hydrate
Doctrine_Hydrate_Array
Doctrine_Hydrate_Exception
Doctrine_Hydrate_Record
Doctrine_Import
Doctrine_Import_Builder
Doctrine_Import_Builder_BaseClass
Doctrine_Import_Builder_Exception
Doctrine_Import_Exception
Doctrine_Import_Firebird
Doctrine_Import_Informix
Doctrine_Import_Mssql
Doctrine_Import_Mysql
Doctrine_Import_Oracle
Doctrine_Import_Pgsql
Doctrine_Import_Reader
Doctrine_Import_Reader_Db
Doctrine_Import_Reader_Exception
Doctrine_Import_Reader_Xml_Propel
Doctrine_Import_Schema
Doctrine_Import_Schema_Xml
Doctrine_Import_Schema_Yml
Doctrine_Import_Sqlite
Doctrine_IntegrityMapper
Doctrine_Lib
Doctrine_Locking_Exception
Doctrine_Locking_Manager_Pessimistic
Doctrine_Manager
Doctrine_Manager_Exception
Doctrine_Node
Doctrine_Node_AdjacencyList
Doctrine_Node_AdjacencyList_LevelOrderIterator
Doctrine_Node_AdjacencyList_PostOrderIterator
Doctrine_Node_AdjacencyList_PreOrderIterator
Doctrine_Node_Exception
Doctrine_Node_MaterializedPath
Doctrine_Node_MaterializedPath_LevelOrderIterator
Doctrine_Node_MaterializedPath_PostOrderIterator
Doctrine_Node_MaterializedPath_PreOrderIterator
Doctrine_Node_NestedSet
Doctrine_Node_NestedSet_LevelOrderIterator
Doctrine_Node_NestedSet_PostOrderIterator
Doctrine_Node_NestedSet_PreOrderIterator
Doctrine_Null
Doctrine_Object
Doctrine_Plugin
Doctrine_Query
Doctrine_Query_Abstract
Doctrine_Query_Check
Doctrine_Query_Condition
Doctrine_Query_Exception
Doctrine_Query_Filter
Doctrine_Query_Filter_Chain
Doctrine_Query_From
Doctrine_Query_Groupby
Doctrine_Query_Having
Doctrine_Query_JoinCondition
Doctrine_Query_Limit
Doctrine_Query_Offset
Doctrine_Query_Orderby
Doctrine_Query_Parser
Doctrine_Query_Part
Doctrine_Query_Select
Doctrine_Query_Set
Doctrine_Query_Where
Doctrine_RawSql
Doctrine_RawSql_Exception
Doctrine_Record
Doctrine_Record_Abstract
Doctrine_Record_Exception
Doctrine_Record_Filter
Doctrine_Record_Iterator
Doctrine_Record_Listener
Doctrine_Record_Listener_Chain
Doctrine_Record_State_Exception
Doctrine_Relation
Doctrine_Relation_Association
Doctrine_Relation_Association_Self
Doctrine_Relation_Exception
Doctrine_Relation_ForeignKey
Doctrine_Relation_LocalKey
Doctrine_Relation_Nest
Doctrine_Relation_Parser
Doctrine_Relation_Parser_Exception
Doctrine_Schema
Doctrine_Schema_Column
Doctrine_Schema_Database
Doctrine_Schema_Exception
Doctrine_Schema_Object
Doctrine_Schema_Relation
Doctrine_Schema_Table
Doctrine_Search
Doctrine_Search_Analyzer
Doctrine_Search_Analyzer_Exception
Doctrine_Search_Analyzer_Standard
Doctrine_Search_Exception
Doctrine_Search_Indexer
Doctrine_Search_Indexer_Dir
Doctrine_Search_Indexer_Exception
Doctrine_Search_Listener
Doctrine_Search_Parser
Doctrine_Search_Query
Doctrine_Search_Record
Doctrine_Search_Scorer
Doctrine_Search_Template
Doctrine_Sequence
Doctrine_Sequence_Db2
Doctrine_Sequence_Exception
Doctrine_Sequence_Firebird
Doctrine_Sequence_Informix
Doctrine_Sequence_Mssql
Doctrine_Sequence_Mysql
Doctrine_Sequence_Oracle
Doctrine_Sequence_Pgsql
Doctrine_Sequence_Sqlite
Doctrine_Table
Doctrine_Table_Exception
Doctrine_Table_Repository
Doctrine_Table_Repository_Exception
Doctrine_Template
Doctrine_Template_NestedSet
Doctrine_Template_Searchable
Doctrine_Template_Taggable
Doctrine_Template_Versionable
Doctrine_Tokenizer
Doctrine_Transaction
Doctrine_Transaction_Exception
Doctrine_Transaction_Firebird
Doctrine_Transaction_Informix
Doctrine_Transaction_Mock
Doctrine_Transaction_Mssql
Doctrine_Transaction_Mysql
Doctrine_Transaction_Oracle
Doctrine_Transaction_Pgsql
Doctrine_Transaction_Sqlite
Doctrine_Tree
Doctrine_Tree_AdjacencyList
Doctrine_Tree_Exception
Doctrine_Tree_MaterializedPath
Doctrine_Tree_NestedSet
Doctrine_Util
Doctrine_Validator
Doctrine_Validator_Country
Doctrine_Validator_Creditcard
Doctrine_Validator_Date
Doctrine_Validator_Email
Doctrine_Validator_Enum
Doctrine_Validator_ErrorStack
Doctrine_Validator_Exception
Doctrine_Validator_HtmlColor
Doctrine_Validator_Ip
Doctrine_Validator_Minlength
Doctrine_Validator_Nospace
Doctrine_Validator_Notblank
Doctrine_Validator_Notnull
Doctrine_Validator_Range
Doctrine_Validator_Regexp
Doctrine_Validator_Unique
Doctrine_Validator_Unsigned
Doctrine_Validator_Usstate
Doctrine_View
Doctrine_View_Exception
Doctrine_Cache
Doctrine_Cache
Doctrine_Cache_Apc
Doctrine_Cache_Array
Doctrine_Cache_Db
Doctrine_Cache_Driver
Doctrine_Cache_Exception
Doctrine_Cache_Memcache
Doctrine_Adapter
Doctrine_Adapter_Db2
Doctrine_Adapter_Mock
Doctrine_Adapter_Mysqli
Doctrine_Adapter_Oracle
Doctrine_Adapter_Statement_Mock
Doctrine_DataDict
Doctrine_DataDict_Firebird
Doctrine_DataDict_Mssql
Doctrine_DataDict_Mysql
Doctrine_DataDict_Oracle
Doctrine_DataDict_Pgsql
Doctrine_DataDict_Sqlite

# Class: Doctrine_Connection

Source Location: /Doctrine/Connection.php

## Class Doctrine_Connection

Class Overview

Implements interfaces: Countable (internal interface) IteratorAggregate (internal interface) Doctrine_Connection A wrapper layer on top of PDO / Doctrine_Adapter Doctrine_Connection is the heart of any Doctrine based application. Event listeners An easy to use, pluggable eventlistener architecture. Aspects such as logging, query profiling and caching can be easily implemented through the use of these listeners 2. Lazy-connecting Creating an instance of Doctrine_Connection does not connect to database. Connecting to database is only invoked when actually needed (for example when query() is being called) 3. Convenience methods Doctrine_Connection provides many convenience methods such as fetchAll(), fetchOne() etc. 4. Modular structure Higher level functionality such as schema importing, exporting, sequence handling etc. is divided into modules. For a full list of connection modules see Doctrine_Connection::$_modules Located in /Doctrine/Connection.php [line 56]
    Doctrine_Object
       |
       --Doctrine_Configurable
          |
          --Doctrine_Connection
Author(s): Konsta Vesterinen <kvesteri@cc.hut.fi> Lukas Smith <smith@pooteeweet.org> (MDB2 library) API Tags:
Abstract: |
Information Tags:
Version: | $Revision: 2290 $
Link: | www.phpdoctrine.com
Since: | 1.0
License: | LGPL
| Properties $availableDrivers $dbh $driverName $isConnected $modules $options $pendingAttributes $properties $serverInfo $supported $tables $_count | Methods __construct addTable beginTransaction clear close commit connect convertBooleans count create driverName errorCode errorInfo evictTables exec execute fetchAll fetchArray fetchAssoc fetchBoth fetchColumn fetchOne fetchRow flush getAttribute getAvailableDrivers getDbh getIterator getManager getName getTable getTables getTransactionLevel hasTable incrementQueryCount insert lastInsertId prepare query queryOne quote quoteIdentifier replace rethrowException rollback select setAttribute setCharset setDateFormat standaloneQuery supports __get __toString

[ Top ]
Direct descendents

Child Class | Description
--- | ---
Doctrine_Connection_Common | standard connection, the parent of pgsql, mysql and sqlite
Doctrine_Connection_Db2 | Doctrine_Connection_Db2
Doctrine_Connection_Firebird | Doctrine_Connection_Firebird
Doctrine_Connection_Informix | Doctrine_Connection_Mysql
Doctrine_Connection_Mssql | Doctrine_Connection_Mssql
Doctrine_Connection_Oracle | Doctrine_Connection_Oracle

[ Top ]
Inherited Properties, Constants, and Methods

Inherited Properties | Inherited Methods | Inherited Constants
--- | --- | ---
Inherited From Doctrine_Configurable Doctrine_Configurable::$attributes Doctrine_Configurable::$parent Doctrine_Configurable::$_impl Inherited From Doctrine_Object Doctrine_Object::$_null | Inherited From Doctrine_Configurable Doctrine_Configurable::addListener() addListener Doctrine_Configurable::addRecordListener() addRecordListener Doctrine_Configurable::getAttribute() returns the value of an attribute Doctrine_Configurable::getAttributes() getAttributes returns all attributes as an array Doctrine_Configurable::getCacheDriver() getCacheDriver Doctrine_Configurable::getImpl() getImpl returns the implementation for given class Doctrine_Configurable::getListener() getListener Doctrine_Configurable::getParent() getParent returns the parent of this component Doctrine_Configurable::getRecordListener() getListener Doctrine_Configurable::setAttribute() setAttribute sets a given attribute Doctrine_Configurable::setEventListener() Doctrine_Configurable::setImpl() setImpl binds given class to given template name Doctrine_Configurable::setListener() setListener Doctrine_Configurable::setParent() sets a parent for this configurable component the parent must be configurable component itself Doctrine_Configurable::setRecordListener() setListener Inherited From Doctrine_Object Doctrine_Object::getNullObject() getNullObject returns the null object associated with this object Doctrine_Object::initNullObject() initNullObject initializes the null object |

[ Top ]
Property Summary

static array | $availableDrivers |
$dbh | $dbh |
string | $driverName |
boolean | $isConnected |
array | $modules |
mixed | $options |
array | $pendingAttributes |
array | $properties |
array | $serverInfo |
array | $supported |
array | $tables |
mixed | $_count |

[ Top ]
Method Summary

static void | getAvailableDrivers() | returns an array of available PDO drivers
Doctrine_Connection | __construct() | the constructor
boolean | addTable() | addTable adds a Doctrine_Table object into connection registry
integer | beginTransaction() | beginTransaction Start a transaction or set a savepoint.
void | clear() | clear clears all repositories
void | close() | close closes the connection
boolean | commit() | 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.
boolean | connect() | connect connects into database
void | convertBooleans() | convertBooleans some drivers need the boolean values to be converted into integers when using DQL API
integer | count() | returns the count of initialized table objects
Doctrine_Record | create() | create creates a record
void | driverName() | converts given driver name
integer | errorCode() | errorCode Fetch the SQLSTATE associated with the last operation on the database handle
array | errorInfo() | errorInfo Fetch extended error information associated with the last operation on the database handle
void | evictTables() | evictTables evicts all tables
PDOStatement|Doctrine_Adapter_Statement | exec() | exec
PDOStatement|Doctrine_Adapter_Statement | execute() | execute
array | fetchAll() | fetchAll
array | fetchArray() | fetchArray
array | fetchAssoc() | fetchAssoc
array | fetchBoth() | fetchBoth
array | fetchColumn() | fetchColumn
mixed | fetchOne() | fetchOne
array | fetchRow() | fetchRow
void | flush() | flush saves all the records from all tables this operation is isolated using a transaction
mixed | getAttribute() | getAttribute retrieves a database connection attribute
PDO | getDbh() | returns the database handler of which this connection uses
ArrayIterator | getIterator() | returns an iterator that iterators through all initialized table objects
Doctrine_Manager | getManager() | returns the manager that created this connection
string | getName() | getName returns the name of this driver
object Doctrine_Table | getTable() | returns a table object for given component name
array | getTables() | returns an array of all initialized tables
integer | getTransactionLevel() | get the current transaction nesting level
boolean | hasTable() | hasTable whether or not this connection has table $name initialized
void | incrementQueryCount() |
boolean | insert() | Inserts a table row with specified data.
void | lastInsertId() | lastInsertId
void | prepare() | prepare
Doctrine_Collection | query() | query queries the database using Doctrine Query Language returns a collection of Doctrine_Record objects
Doctrine_Record|false | queryOne() | query queries the database using Doctrine Query Language and returns the first record found
mixed | quote() | quote quotes given input parameter
string | quoteIdentifier() | Quote a string so it can be safely used as a table or column name
integer | 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() | rethrowException
boolean | rollback() | rollback
PDOStatement | select() | queries the database with limit and offset added to the query and returns a PDOStatement object
boolean | setAttribute() | setAttribute sets an attribute
void | setCharset() | Set the charset on the current connection
void | setDateFormat() | Set the date/time format for the current connection
PDOStatement|Doctrine_Adapter_Statement | standaloneQuery() | standaloneQuery
boolean | supports() | supports
Doctrine_Connection_Module | __get() | __get lazy loads given module and returns it
string | __toString() | returns a string representation of this object

[ Top ]
Properties
static array $availableDrivers = array(
'Mysql',
'Pgsql',
'Oracle',
'Informix',
'Mssql',
'Sqlite',
'Firebird'
) [line 147]
API Tags:

Access: | private

[ Top ]
$dbh $dbh [line 61]
API Tags:

Access: | protected

[ Top ]
string $driverName [line 70]
API Tags:

Access: | protected

Redefined in descendants as:

- Doctrine_Connection_Mock::$driverName
- Doctrine_Connection_Mysql::$driverName
- Doctrine_Connection_Pgsql::$driverName
- Doctrine_Connection_Sqlite::$driverName
- Doctrine_Connection_Firebird::$driverName
- Doctrine_Connection_Informix::$driverName
- Doctrine_Connection_Mssql::$driverName
- Doctrine_Connection_Oracle::$driverName

[ Top ]
boolean $isConnected = false [line 74]
API Tags:

Access: | protected

[ Top ]
array $modules = array('transaction' => false,
'expression' => false,
'dataDict' => false,
'export' => false,
'import' => false,
'sequence' => false,
'unitOfWork' => false,
'formatter' => false,
'util' => false,
) [line 115]
API Tags:

See: | Doctrine_Sequence
See: | Doctrine_Connection_UnitOfWork
See: | Doctrine_Formatter
See: | Doctrine_Connection::__get()
See: | Doctrine_Transaction
See: | Doctrine_DataDict
See: | Doctrine_Expression
See: | Doctrine_Export
Access: | private

[ Top ]
mixed $options = array() [line 143]
API Tags:

Access: | protected

[ Top ]
array $pendingAttributes = array() [line 86]
API Tags:

Access: | protected

[ Top ]
array $properties = array('sql_comments' => array(array('start' => '--', 'end' => "\n", 'escape' => false),array('start'=>'/*','end'=>'*/','escape'=>false)),'identifier_quoting'=>array('start'=>'"','end'=>'"','escape'=>'"'),'string_quoting'=>array('start'=>"'",'end'=>"'",'escape'=>false,'escape_pattern'=>false),'wildcards'=>array('%','_'),'varchar_max_length'=>255,) [line 128]
API Tags:

Access: | protected

[ Top ]
array $serverInfo = array() [line 141]
API Tags:

Access: | protected

[ Top ]
array $supported = array() [line 80]
API Tags:

Access: | protected

[ Top ]
array $tables = array() [line 66]
API Tags:

Access: | protected

[ Top ]
mixed $_count [line 156]
API Tags:

Access: | protected

[ Top ]
Methods
static method getAvailableDrivers [line 224]

`static void getAvailableDrivers( )`

returns an array of available PDO drivers

API Tags:

Access: | public

[ Top ]
Constructor __construct [line 164]

`Doctrine_Connection __construct( Doctrine_Manager $manager, PDO|Doctrine_Adapter_Interface $adapter, [ $user = null], [ $pass = null] )`

the constructor

Parameters:

Doctrine_Manager | $manager: | the manager object
PDO|Doctrine_Adapter_Interface | $adapter: | database driver
| $user: |
| $pass: |

API Tags:

Access: | public

Redefined in descendants as:

- Doctrine_Connection_Mock::__construct() : the constructor
- Doctrine_Connection_Mysql::__construct() : the constructor
- Doctrine_Connection_Pgsql::__construct() : the constructor
- Doctrine_Connection_Sqlite::__construct() : the constructor
- Doctrine_Connection_Firebird::__construct() : the constructor
- Doctrine_Connection_Informix::__construct() : the constructor
- Doctrine_Connection_Mssql::__construct() : the constructor
- Doctrine_Connection_Oracle::__construct()

[ Top ]
addTable [line 945]

`boolean addTable( Doctrine_Table $table )`

addTable adds a Doctrine_Table object into connection registry

Parameters:

$table | $table: | a Doctrine_Table object to be added into registry

API Tags:

Access: | public

[ Top ]
beginTransaction [line 1086]

`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

[ Top ]
clear [line 987]

`void clear( )`

clear clears all repositories

API Tags:

Access: | public

[ Top ]
close [line 1011]

`void close( )`

close closes the connection

API Tags:

Access: | public

[ Top ]
commit [line 1103]

`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

[ Top ]
connect [line 323]

`boolean connect( )`

connect connects into database

API Tags:

Access: | public

Redefined in descendants as:

- Doctrine_Connection_Sqlite::connect() : initializes database functions missing in sqlite

[ Top ]
convertBooleans [line 562]

`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:

array | $item: |

API Tags:

Access: | public

Redefined in descendants as:

- Doctrine_Connection_Pgsql::convertBooleans() : convertBoolean some drivers need the boolean values to be converted into integers when using DQL API

[ Top ]
count [line 934]

`integer count( )`

returns the count of initialized table objects

API Tags:

Access: | public

Implementation of:

Countable::count

[ Top ]
create [line 963]

`Doctrine_Record create( string $name )`

create creates a record

create creates a record

Parameters:

string | $name: | component name

API Tags:

Return: | Doctrine_Record object
Access: | public

[ Top ]
driverName [line 379]

`void driverName( $name )`

converts given driver name

Parameters:

| $name: |

API Tags:

Access: | public

[ Top ]
errorCode [line 1039]

`integer errorCode( )`

errorCode Fetch the SQLSTATE associated with the last operation on the database handle

API Tags:

Access: | public

[ Top ]
errorInfo [line 1051]

`array errorInfo( )`

errorInfo Fetch extended error information associated with the last operation on the database handle

API Tags:

Access: | public

[ Top ]
evictTables [line 1000]

`void evictTables( )`

evictTables evicts all tables

API Tags:

Access: | public

[ Top ]
exec [line 816]

`PDOStatement|Doctrine_Adapter_Statement exec( string $query, [ $params = array()] )`

exec

Parameters:

string | $query: | sql query
array | $params: | query parameters

API Tags:

Access: | public

[ Top ]
execute [line 781]

`PDOStatement|Doctrine_Adapter_Statement execute( string $query, [ $params = array()] )`

execute

Parameters:

string | $query: | sql query
array | $params: | query parameters

API Tags:

Access: | public

[ Top ]
fetchAll [line 595]

`array fetchAll( string $statement, [ $params = array()] )`

fetchAll

Parameters:

string | $statement: | sql query to be executed
array | $params: | prepared statement params

API Tags:

Access: | public

[ Top ]
fetchArray [line 629]

`array fetchArray( string $statement, [ $params = array()] )`

fetchArray

Parameters:

string | $statement: | sql query to be executed
array | $params: | prepared statement params

API Tags:

Access: | public

[ Top ]
fetchAssoc [line 652]

`array fetchAssoc( string $statement, [ $params = array()] )`

fetchAssoc

Parameters:

string | $statement: | sql query to be executed
array | $params: | prepared statement params

API Tags:

Access: | public

[ Top ]
fetchBoth [line 663]

`array fetchBoth( string $statement, [ $params = array()] )`

fetchBoth

Parameters:

string | $statement: | sql query to be executed
array | $params: | prepared statement params

API Tags:

Access: | public

[ Top ]
fetchColumn [line 641]

`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:

Access: | public

[ Top ]
fetchOne [line 607]

`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:

Access: | public

[ Top ]
fetchRow [line 618]

`array fetchRow( string $statement, [ $params = array()] )`

fetchRow

Parameters:

string | $statement: | sql query to be executed
array | $params: | prepared statement params

API Tags:

Access: | public

[ Top ]
flush [line 975]

`void flush( )`

flush saves all the records from all tables this operation is isolated using a transaction

API Tags:

Access: | public

Information Tags:

Throws: | PDOException if something went wrong at database level

[ Top ]
getAttribute [line 196]

`mixed getAttribute( integer $attribute )`

getAttribute retrieves a database connection attribute

Parameters:

integer | $attribute: |

API Tags:

Access: | public

Redefinition of:

Doctrine_Configurable::getAttribute()
  returns the value of an attribute

[ Top ]
getDbh [line 311]

`PDO getDbh( )`

returns the database handler of which this connection uses

API Tags:

Return: | the database handler
Access: | public

[ Top ]
getIterator [line 925]

`ArrayIterator getIterator( )`

returns an iterator that iterators through all initialized table objects

1. foreach ($conn as $index => $table) {
2. print $table; // get a string representation of each table object
3. }

API Tags:

Return: | SPL ArrayIterator object
Access: | public

Implementation of:

IteratorAggregate::getIterator

[ Top ]
getManager [line 302]

`Doctrine_Manager getManager( )`

returns the manager that created this connection

API Tags:

Access: | public

[ Top ]
getName [line 255]

`string getName( )`

getName returns the name of this driver

API Tags:

Return: | the name of this driver
Access: | public

[ Top ]
getTable [line 886]

`object Doctrine_Table getTable( string $name, [ $allowExport = true] )`

returns a table object for given component name

Parameters:

string | $name: | component name
| $allowExport: |

API Tags:

Access: | public

[ Top ]
getTables [line 909]

`array getTables( )`

returns an array of all initialized tables

API Tags:

Access: | public

[ Top ]
getTransactionLevel [line 1029]

`integer getTransactionLevel( )`

get the current transaction nesting level

API Tags:

Access: | public

[ Top ]
hasTable [line 876]

`boolean hasTable( mixed $name )`

hasTable whether or not this connection has table $name initialized

Parameters:

mixed | $name: |

API Tags:

Access: | public

[ Top ]
incrementQueryCount [line 370]

`void incrementQueryCount( )`

API Tags:

Access: | public

[ Top ]
insert [line 467]

`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:

Access: | public

[ Top ]
lastInsertId [line 1069]

`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:

Access: | public

[ Top ]
prepare [line 694]

`void prepare( string $statement )`

prepare

Parameters:

string | $statement: |

API Tags:

Access: | public

[ Top ]
query [line 683]

`Doctrine_Collection query( string $query, [ $params = array()] )`

query queries the database using Doctrine Query Language returns a collection of Doctrine_Record objects

1. $users = $conn->query('SELECT u.* FROM User u');
3. $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

[ Top ]
queryOne [line 736]

`Doctrine_Record|false queryOne( string $query, [ $params = array()] )`

query queries the database using Doctrine Query Language and returns the first record found

1. $user = $conn->queryOne('SELECT u.* FROM User u WHERE u.id = ?', array(1));
3. $user = $conn->queryOne('SELECT u.* FROM User u WHERE u.name LIKE ? AND u.password = ?',
4. array('someone', 'password')
5. );

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

[ Top ]
quote [line 574]

`mixed quote( mixed $input, [string $type = null] )`

quote quotes given input parameter

Parameters:

mixed | $input: | parameter to be quoted
string | $type: |

API Tags:

Access: | public

[ Top ]
quoteIdentifier [line 541]

`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:

- Doctrine_Connection_Mssql::quoteIdentifier() : quoteIdentifier Quote a string so it can be safely used as a table / column name

[ Top ]
replace [line 428]

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

[ Top ]
rethrowException [line 849]

`void rethrowException( $e, $invoker )`

rethrowException

Parameters:

Exception | $e: |
| $invoker: |

API Tags:

Access: | public

Information Tags:

Throws: | Doctrine_Connection_Exception

[ Top ]
rollback [line 1121]

`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

[ Top ]
select [line 755]

`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:

Access: | public

[ Top ]
setAttribute [line 236]

`boolean setAttribute( integer $attribute, mixed $value )`

setAttribute sets an attribute

Parameters:

integer | $attribute: |
mixed | $value: |

API Tags:

Access: | public

Redefinition of:

Doctrine_Configurable::setAttribute()
  setAttribute sets a given attribute

[ Top ]
setCharset [line 505]

`void setCharset( string $charset )`

Set the charset on the current connection

Parameters:

string | $charset: | charset

API Tags:

Access: | public

Redefined in descendants as:

- Doctrine_Connection_Mysql::setCharset() : Set the charset on the current connection
- Doctrine_Connection_Pgsql::setCharset() : Set the charset on the current connection
- Doctrine_Connection_Firebird::setCharset() : Set the charset on the current connection

[ Top ]
setDateFormat [line 585]

`void setDateFormat( [string $format = null] )`

Set the date/time format for the current connection

Parameters:

string | $format: | time format

API Tags:

Access: | public

Redefined in descendants as:

- Doctrine_Connection_Oracle::setDateFormat() : Sets up the date/time format

[ Top ]
standaloneQuery [line 770]

`PDOStatement|Doctrine_Adapter_Statement standaloneQuery( string $query, [array $params = array()] )`

standaloneQuery

Parameters:

string | $query: | sql query
array | $params: | query parameters

API Tags:

Access: | public

[ Top ]
supports [line 388]

`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

[ Top ]
__get [line 272]

`Doctrine_Connection_Module __get( string $name )`

__get lazy loads given module and returns it

Parameters:

string | $name: | the name of the module to get

API Tags:

Return: | connection module
See: | Doctrine_Connection::$modules all availible modules
See: | Doctrine_DataDict
See: | Doctrine_Transaction
See: | Doctrine_Export
See: | Doctrine_Expression
Access: | public

Information Tags:

Throws: | Doctrine_Connection_Exception if trying to get an unknown module

[ Top ]
__toString [line 1130]

`string __toString( )`

returns a string representation of this object

API Tags:

Access: | public

[ Top ]