Db/Adapter/Pdo/Abstract.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework
LICENSE This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Db  
Subpackage
Adapter  
Version
$Id$  

\Zend_Db_Adapter_Pdo_Abstract

Package: Zend_Db\Adapter
Class for connecting to SQL databases and performing common operations using PDO.
Parent(s)
\Zend_Db_Adapter_Abstract
Children
\Zend_Db_Adapter_Pdo_Mssql
\Zend_Db_Adapter_Pdo_Pgsql
\Zend_Db_Adapter_Pdo_Ibm
\Zend_Db_Adapter_Pdo_Oci
\Zend_Db_Adapter_Pdo_Mysql
\Zend_Db_Adapter_Pdo_Sqlite
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotectedstring $_defaultStmtClass = 'Zend_Db_Statement_Pdo'
Default class name for a DB statement.
Default value'Zend_Db_Statement_Pdo'Details
Type
string

Methods

methodprotected_beginTransaction() : void

Begin a transaction.

methodprotected_commit() : void

Commit a transaction.

methodprotected_connect() : void

Creates a PDO object and connects to the database.

Throws
ExceptionDescription
\Zend_Db_Adapter_Exception
methodprotected_dsn() : string

Creates a PDO DSN for the adapter from $this->_config settings.

Returns
TypeDescription
string
methodprotected_quote(string $value) : string

Quote a raw string.

Parameters
NameTypeDescription
$valuestring

Raw string

Returns
TypeDescription
stringQuoted string
methodprotected_rollBack() : void

Roll-back a transaction.

methodpubliccloseConnection() : void

Force the connection to close.

methodpublicexec(mixed $sql) : integer

Executes an SQL statement and return the number of affected rows

Parameters
NameTypeDescription
$sqlmixed

The SQL statement with placeholders. May be a string or Zend_Db_Select.

Returns
TypeDescription
integerNumber of rows that were modified or deleted by the SQL statement
methodpublicgetServerVersion() : string

Retrieve server version in PHP style

Returns
TypeDescription
string
methodpublicisConnected() : boolean

Test if a connection is active

Returns
TypeDescription
boolean
methodpubliclastInsertId(string $tableName = null, string $primaryKey = null) : string

Gets the last ID generated automatically by an IDENTITY/AUTOINCREMENT column.

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.
Parameters
NameTypeDescription
$tableNamestring

OPTIONAL Name of table.

$primaryKeystring

OPTIONAL Name of primary key column.

Returns
TypeDescription
string
methodpublicprepare(string $sql) : \PDOStatement

Prepares an SQL statement.

Parameters
NameTypeDescription
$sqlstring

The SQL statement with placeholders.

Returns
TypeDescription
\PDOStatement
methodpublicquery(string | \Zend_Db_Select $sql, array $bind = array()) : \Zend_Db_Statement_Pdo

Special handling for PDO query().

All bind parameter names must begin with ':'
Parameters
NameTypeDescription
$sqlstring | \Zend_Db_Select

The SQL statement with placeholders.

$bindarray

An array of data to bind to the placeholders.

Returns
TypeDescription
\Zend_Db_Statement_Pdo
Throws
ExceptionDescription
\Zend_Db_Adapter_ExceptionTo re-throw PDOException.
methodpublicsetFetchMode(int $mode) : void

Set the PDO fetch mode.

Parameters
NameTypeDescription
$modeint

A PDO fetch mode.

Throws
ExceptionDescription
\Zend_Db_Adapter_Exception
Details
Todo
Support FETCH_CLASS and FETCH_INTO.  
methodpublicsupportsParameters(string $type) : bool

Check if the adapter supports real SQL parameters.

Parameters
NameTypeDescription
$typestring

'positional' or 'named'

Returns
TypeDescription
bool
Documentation was generated by phpDocumentor 2.2.0 .