PHP Class Zend_Db_Adapter_Pdo_Abstract

Inheritance: extends Zend_Db_Adapter_Abstract
Show file Open project: kimai/kimai Class Usage Examples

Protected Properties

Property Type Description
$_defaultStmtClass string Default class name for a DB statement.

Public Methods

Method Description
closeConnection ( ) : void Force the connection to close.
exec ( mixed $sql ) : integer Executes an SQL statement and return the number of affected rows
getServerVersion ( ) : string Retrieve server version in PHP style
isConnected ( ) : boolean Test if a connection is active
lastInsertId ( string $tableName = null, string $primaryKey = null ) : string Gets the last ID generated automatically by an IDENTITY/AUTOINCREMENT column.
prepare ( string $sql ) : PDOStatement Prepares an SQL statement.
query ( string | Zend_Db_Select $sql, array $bind = [] ) : Zend_Db_Statement_Pdo Special handling for PDO query().
setFetchMode ( integer $mode ) : void Set the PDO fetch mode.
supportsParameters ( string $type ) : boolean Check if the adapter supports real SQL parameters.

Protected Methods

Method Description
_beginTransaction ( ) Begin a transaction.
_commit ( ) Commit a transaction.
_connect ( ) : void Creates a PDO object and connects to the database.
_dsn ( ) : string Creates a PDO DSN for the adapter from $this->_config settings.
_quote ( string $value ) : string Quote a raw string.
_rollBack ( ) Roll-back a transaction.

Method Details

_beginTransaction() protected method

Begin a transaction.
protected _beginTransaction ( )

_commit() protected method

Commit a transaction.
protected _commit ( )

_connect() protected method

Creates a PDO object and connects to the database.
protected _connect ( ) : void
return void

_dsn() protected method

Creates a PDO DSN for the adapter from $this->_config settings.
protected _dsn ( ) : string
return string

_quote() protected method

Quote a raw string.
protected _quote ( string $value ) : string
$value string Raw string
return string Quoted string

_rollBack() protected method

Roll-back a transaction.
protected _rollBack ( )

closeConnection() public method

Force the connection to close.
public closeConnection ( ) : void
return void

exec() public method

Executes an SQL statement and return the number of affected rows
public exec ( mixed $sql ) : integer
$sql mixed The SQL statement with placeholders. May be a string or Zend_Db_Select.
return integer Number of rows that were modified or deleted by the SQL statement

getServerVersion() public method

Retrieve server version in PHP style
public getServerVersion ( ) : string
return string

isConnected() public method

Test if a connection is active
public isConnected ( ) : boolean
return boolean

lastInsertId() public method

As a convention, on RDBMS brands that support sequences (e.g. Oracle, PostgreSQL, DB2), this method forms the name of a sequence from the arguments and returns the last id generated by that sequence. On RDBMS brands that support IDENTITY/AUTOINCREMENT columns, this method returns the last value generated for such a column, and the table name argument is disregarded. On RDBMS brands that don't support sequences, $tableName and $primaryKey are ignored.
public lastInsertId ( string $tableName = null, string $primaryKey = null ) : string
$tableName string OPTIONAL Name of table.
$primaryKey string OPTIONAL Name of primary key column.
return string

prepare() public method

Prepares an SQL statement.
public prepare ( string $sql ) : PDOStatement
$sql string The SQL statement with placeholders.
return PDOStatement

query() public method

All bind parameter names must begin with ':'
public query ( string | Zend_Db_Select $sql, array $bind = [] ) : Zend_Db_Statement_Pdo
$sql string | Zend_Db_Select The SQL statement with placeholders.
$bind array An array of data to bind to the placeholders.
return Zend_Db_Statement_Pdo

setFetchMode() public method

Set the PDO fetch mode.
public setFetchMode ( integer $mode ) : void
$mode integer A PDO fetch mode.
return void

supportsParameters() public method

Check if the adapter supports real SQL parameters.
public supportsParameters ( string $type ) : boolean
$type string 'positional' or 'named'
return boolean

Property Details

$_defaultStmtClass protected property

Default class name for a DB statement.
protected string $_defaultStmtClass
return string