API Documentation

Zend/Db/Adapter/Pdo/Abstract.php

Show: inherited
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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Db  
Subpackage
Adapter  
Version
$Id: Abstract.php 24594 2012-01-05 21:27:01Z matthew $  

\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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

Propertyprotectedstring  $_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
Exception Description
\Zend_Db_Adapter_Exception
methodprotected_dsn( ) : string

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

Returns
Type Description
string
methodprotected_quote( string $value ) : string

Quote a raw string.

Parameters
Name Type Description
$value string

Raw string

Returns
Type Description
string Quoted 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
Name Type Description
$sql mixed

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

Returns
Type Description
integer Number of rows that were modified or deleted by the SQL statement
methodpublicgetServerVersion( ) : string

Retrieve server version in PHP style

Returns
Type Description
string
methodpublicisConnected( ) : boolean

Test if a connection is active

Returns
Type Description
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
Name Type Description
$tableName string

OPTIONAL Name of table.

$primaryKey string

OPTIONAL Name of primary key column.

Returns
Type Description
string
methodpublicprepare( string $sql ) : \PDOStatement

Prepares an SQL statement.

Parameters
Name Type Description
$sql string

The SQL statement with placeholders.

Returns
Type Description
\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
Name Type Description
$sql string|\Zend_Db_Select

The SQL statement with placeholders.

$bind array

An array of data to bind to the placeholders.

Returns
Type Description
\Zend_Db_Statement_Pdo
Throws
Exception Description
\Zend_Db_Adapter_Exception To re-throw PDOException.
methodpublicsetFetchMode( int $mode ) : void

Set the PDO fetch mode.

Parameters
Name Type Description
$mode int

A PDO fetch mode.

Throws
Exception Description
\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
Name Type Description
$type string

'positional' or 'named'

Returns
Type Description
bool
Documentation was generated by DocBlox 0.15.1.