Pt_BR En Ja De Fr 
You are currently viewing the Development branch api documentation. Switch to 0.11 or 1.0

Development Doctrine_Connection

Doctrine Connection

A wrapper layer on top of PDO / Doctrine_Adapter Doctrine_Connection is the heart of any Doctrine based application. 2. Lazy-connecting Creating an instance of Doctrine_Connection does not connect to database. Connecting to database is o

Direct Sub-Classes

Method Details

  • incrementQueryCount()


  • (EventManager) getEventManager()

    Gets the EventManager used by the Connection.


  • getDriverName()

    Gets the name of the instance driver


  • $table The table to insert data into
    $values An associateve array containing column-value pairs.

    (mixed) update($tableName, $data, $identifier, $table, $values)

    Updates table row(s) with specified data

    Doctrine_Connection

    throws Doctrine_Connection_Exception if something went wrong at the database level


  • $statement sql query to be executed
    $params prepared statement params

    (array) fetchArray($statement, $params = array())


  • (PDO) getDbh()

    returns the database handler which this connection uses

    Doctrine_Connection


  • $query sql query
    $params query parameters

    exec($query, $params = array())


  • (string) getName()

    getName returns the name of this driver

    Doctrine_Connection


  • setConfiguration(( ) $config)

    Sets the Configuration used by the Connection.


  • $statement sql query to be executed
    $params prepared statement params
    $colnum 0-indexed column number to retrieve

    (array) fetchColumn($statement, $params = array(), $colnum)


  • $savepoint name of a savepoint to release

    (boolean) commit($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

    Doctrine_Connection

    throws Doctrine_Validator_Exception if the transaction fails due to record validations


  • $statement sql query to be executed
    $params prepared statement params

    (array) fetchBoth($statement, $params = array())


  • $savepoint name of a savepoint to set

    (integer) beginTransaction($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

    Doctrine_Connection

    throws Doctrine_Transaction_Exception if the transaction fails at database level


  • $identifier An associateve array containing identifier fieldname-value pairs.
    $table The table to delete data from

    (integer) delete($tableName, $identifier, $table)

    Deletes table row(s) matching the specified identifier.

    Doctrine_Connection

    throws Doctrine_Connection_Exception if something went wrong at the database level


  • convertBooleans($item)

    convertBooleans some drivers need the boolean values to be converted into integers when using DQL API

    This method takes care of that conversion


  • select($query, $limit, $offset)

    queries the database with limit and offset added to the query and returns a Doctrine_Connection_Statement object


  • getDefaultIdGeneratorType()

    Gets the default (preferred) Id generation strategy of the database platform.


  • setName($name)

    Sets the name of the connection


  • (array) errorInfo()

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


  • getAvailableDrivers()

    returns an array of available PDO drivers


  • (mixed) dropDatabase()

    Method for dropping the database for the connection instance

    Doctrine_Connection


  • $savepoint Name of a savepoint to rollback to.

    (boolean) rollback($savepoint = null)

    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 sta

    this method can be listened with onPreTransactionRollback and onTransactionRollback eventlistener methods

    Doctrine_Connection

    throws Doctrine_Transaction_Exception If the rollback operation fails at database level.


  • rethrowException($e, $invoker)

    Wraps the given exception into a driver-specific exception and rethrows it.

    throws Doctrine_Connection_Exception


  • $table Name of the table into which a new row was inserted.
    $field Name of the field into which a new row was inserted.

    lastInsertId($table = null, $field = null)

    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 e


  • (integer) getTransactionLevel()

    Returns the current total transaction nesting level.

    Doctrine_Connection


  • (string) __toString()

    returns a string representation of this object


  • (string) _constructPdoDsn()

    Constructs the PDO DSN for use in the PDO constructor.

    Concrete connection implementations override this implementation to create the proper DSN.


  • $statement sql query to be executed
    $params prepared statement params

    (array) fetchRow($statement, $params = array())


  • getSequenceModule()


  • close()

    Closes the connection.


  • $feature the name of the feature

    (boolean) supports($feature)

    Checks whether a certain feature is supported.

    Doctrine_Connection


  • (integer) errorCode()

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


  • getFormatter()


  • $query sql query
    $params query parameters

    standaloneQuery($query, $params = array())


  • $input parameter to be quoted

    (mixed) quote($input, $type = null)

    Quotes given input parameter


  • (string) modifyLimitSubquery($rootTable, $query, $limit = false, $offset = false, $isManip = false)

    Creates dbms specific LIMIT/OFFSET SQL for the subqueries that are used in the context of the limit-subquery algorithm.


  • $statement sql query to be executed
    $params prepared statement params
    $colnum 0-indexed column number to retrieve

    (mixed) fetchOne($statement, $params = array(), $colnum)


  • $charset charset

    setCharset($charset)

    Set the charset on the current connection


  • (Configuration) getConfiguration()

    Gets the Configuration used by the Connection.


  • $str identifier name to be quoted
    $checkOption check the 'quote_identifier' option

    (string) quoteIdentifier($str, $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 usi

    Doctrine_Connection


  • $params The connection parameters.

    __construct($params)

    Constructor.


  • (PDO) getPdo()

    Gets the PDO handle used by the connection.


  • (mixed) getAttribute($attribute)

    getAttribute retrieves a database connection attribute


  • $format time format

    setDateFormat($format = null)

    Set the date/time format for the current connection


  • (integer) count()

    Returns the number of queries executed by the connection.


  • $query sql query
    $params query parameters

    execute($query, $params = array())


  • setEventManager(( ) $eventManager)

    Sets the EventManager used by the Connection.


  • $table The table to insert data into.
    $fields An associateve array containing fieldname-value pairs.

    (mixed) insert($tableName, $data, $table, $fields)

    Inserts a table row with specified data.

    Doctrine_Connection


  • (boolean) connect()

    Establishes the connection with the database.


  • (string) modifyLimitQuery($query, $limit = false, $offset = false, $isManip = false)


  • $tableName name of the table on which the REPLACE query will be executed.
    $data

    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.

    $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 wi

    (integer) replace($tableName, $data, $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 a

    Doctrine_Connection

    throws Doctrine_Connection_Exception if this driver doesn't support replace


  • prepare($statement)


  • $statement sql query to be executed
    $params prepared statement params

    (array) fetchAssoc($statement, $params = array())


  • (mixed) createDatabase()

    Creates the database for the connection instance.

    Doctrine_Connection


  • $statement sql query to be executed
    $params prepared statement params

    (array) fetchAll($statement, $params = array())


  • getProperty($name)


Comments (0) [ add comment ]

 No Comments

Add Comment

Add New Comment
Please enter follow the doctrine