Abstract Class Zend_Db_Adapter_Abstract

Description

Class for connecting to SQL databases and performing common operations.

  • abstract:
  • license: New BSD License
  • copyright: Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)

Located in /Zend/Db/Adapter/Abstract.php (line 42)


	
			
Direct descendents
Class Description
 class Zend_Db_Adapter_Db2
 class Zend_Db_Adapter_Oracle
Abstract class Zend_Db_Adapter_Pdo_Abstract Class for connecting to SQL databases and performing common operations using PDO.
Variable Summary
 array $_config
 object|resource|null $_connection
 integer $_fetchMode
Method Summary
 Zend_Db_Adapter_Abstract __construct (array $config)
 void commit ()
 int delete (string $table, string $where)
 array describeTable ( $table)
 array fetchAll (string $sql, [array $bind = null])
 string fetchAssoc (string $sql, [array $bind = null])
 array fetchCol (string $sql, [array $bind = null])
 string fetchOne (string $sql, [array $bind = null])
 string fetchPairs (string $sql, [array $bind = null])
 array fetchRow (string $sql, [array $bind = null])
 object|resource|null getConnection ()
 int getFetchMode ()
 int insert (string $table, array $bind)
 integer lastInsertId ([string $tableName = null], [string $primaryKey = null])
 string limit ( $sql,  $count,  $offset)
 array listTables ()
 Zend_Db_Statment|PDOStatement prepare (string $sql)
 Zend_Db_Statement query (string $sql, [array $bind = array()])
 mixed quote (mixed $value)
 string quoteIdentifier ( $string, string $ident)
 mixed quoteInto ( $text,  $value, string $txt, mixed $val)
 void rollBack ()
 void setFetchMode (integer $mode)
 int update (string $table, array $bind, string $where)
 void _commit ()
 void _connect ()
 string _quote (string $value)
 void _rollBack ()
Variables
array $_config = array() (line 50)

User-provided configuration

  • access: protected

Redefined in descendants as:
object|resource|null $_connection = null (line 71)

Database connection

  • access: protected
integer $_fetchMode = Zend_Db::FETCH_ASSOC (line 57)

Fetch mode

  • access: protected
Zend_Db_Profiler $_profiler (line 64)

Query profiler

  • access: protected
Methods
Constructor __construct (line 87)

Constructor.

$config is an array of key/value pairs containing configuration options. These options are common to most adapters:

dbname => (string) The name of the database to user (required) username => (string) Connect to the database as this username (optional). password => (string) Password associated with the username (optional). host => (string) What host to connect to (default 127.0.0.1).

  • access: public
Zend_Db_Adapter_Abstract __construct (array $config)
  • array $config: An array of configuration keys.

Redefined in descendants as:
beginTransaction (line 170)

Leave autocommit mode and begin a transaction.

  • access: public
void beginTransaction ()
commit (line 184)

Commit a transaction and return to autocommit mode.

  • access: public
void commit ()
delete (line 266)

Deletes table rows based on a WHERE clause.

  • return: The number of affected rows.
  • access: public
int delete (string $table, string $where)
  • string $table: The table to udpate.
  • string $where: DELETE WHERE clause.
describeTable (line 474)

Returns the column descriptions for a table.

  • access: public
  • abstract:
array describeTable ( $table)
  • $table

Redefined in descendants as:
fetchAll (line 307)

Fetches all SQL result rows as a sequential array.

  • access: public
array fetchAll (string $sql, [array $bind = null])
  • string $sql: An SQL SELECT statement.
  • array $bind: Data to bind into SELECT placeholders.
fetchAssoc (line 324)

Fetches all SQL result rows as an associative array.

The first column is the key, the entire row array is the value.

  • access: public
string fetchAssoc (string $sql, [array $bind = null])
  • string $sql: An SQL SELECT statement.
  • array $bind: Data to bind into SELECT placeholders.

Redefined in descendants as:
fetchCol (line 345)

Fetches the first column of all SQL result rows as an array.

The first column in each row is used as the array key.

  • access: public
array fetchCol (string $sql, [array $bind = null])
  • string $sql: An SQL SELECT statement.
  • array $bind: Data to bind into SELECT placeholders.
fetchOne (line 380)

Fetches the first column of the first row of the SQL result.

  • access: public
string fetchOne (string $sql, [array $bind = null])
  • string $sql: An SQL SELECT statement.
  • array $bind: Data to bind into SELECT placeholders.
fetchPairs (line 362)

Fetches all SQL result rows as an array of key-value pairs.

The first column is the key, the second column is the value.

  • access: public
string fetchPairs (string $sql, [array $bind = null])
  • string $sql: An SQL SELECT statement.
  • array $bind: Data to bind into SELECT placeholders.
fetchRow (line 394)

Fetches the first row of the SQL result.

  • access: public
array fetchRow (string $sql, [array $bind = null])
  • string $sql: An SQL SELECT statement.
  • array $bind: Data to bind into SELECT placeholders.
getConnection (line 119)

Returns the underlying database connection object or resource. If not presently connected, this may return null.

  • access: public
object|resource|null getConnection ()
getFetchMode (line 294)

Get the fetch mode.

  • access: public
int getFetchMode ()
getProfiler (line 130)

Returns the profiler for this adapter.

  • access: public
Zend_Db_Profiler getProfiler ()
insert (line 216)

Inserts a table row with specified data.

  • return: The number of affected rows.
  • access: public
int insert (string $table, array $bind)
  • string $table: The table to insert data into.
  • array $bind: Column-value pairs.

Redefined in descendants as:
lastInsertId (line 510)

Gets the last inserted ID.

  • access: public
  • abstract:
integer lastInsertId ([string $tableName = null], [string $primaryKey = null])
  • string $tableName: name of table (or sequence) associated with sequence
  • string $primaryKey: primary key in $tableName

Redefined in descendants as:
limit (line 545)

Adds an adapter-specific LIMIT clause to the SELECT statement.

  • access: public
  • abstract:
string limit ( $sql,  $count,  $offset)
  • $sql
  • $count
  • $offset

Redefined in descendants as:
listTables (line 466)

Returns a list of the tables in the database.

  • access: public
  • abstract:
array listTables ()

Redefined in descendants as:
prepare (line 500)

Prepare a statement and return a PDOStatement-like object.

  • access: public
  • abstract:
Zend_Db_Statment|PDOStatement prepare (string $sql)
  • string $sql: SQL query

Redefined in descendants as:
query (line 143)

Prepares and executes an SQL statement with bound data.

  • return: (may also be PDOStatement in the case of PDO)
  • access: public
Zend_Db_Statement query (string $sql, [array $bind = array()])
  • string $sql: The SQL statement with placeholders.
  • array $bind: An array of data to bind to the placeholders.
quote (line 410)

Safely quotes a value for an SQL statement.

If an array is passed as the value, the array values are quoted and then returned as a comma-separated string.

  • return: An SQL-safe quoted value (or string of separated values).
  • access: public
mixed quote (mixed $value)
  • mixed $value: The value to quote.
quoteIdentifier (line 458)

Quotes an identifier.

  • return: The quoted identifier.
  • access: public
  • abstract:
string quoteIdentifier ( $string, string $ident)
  • string $ident: The identifier.
  • $string

Redefined in descendants as:
quoteInto (line 441)

Quotes a value and places into a piece of text at a placeholder.

The placeholder is a question-mark; all placeholders will be replaced with the quoted value. For example:

  1.  $text "WHERE date < ?";
  2.  $date "2005-01-02";
  3.  $safe $sql->quoteInto($text$date);

  • return: An SQL-safe quoted value placed into the orignal text.
  • access: public
mixed quoteInto ( $text,  $value, string $txt, mixed $val)
  • string $txt: The text with a placeholder.
  • mixed $val: The value to quote.
  • $text
  • $value
rollBack (line 199)

Roll back a transaction and return to autocommit mode.

  • access: public
void rollBack ()
select (line 283)

Creates and returns a new Zend_Db_Select object for this adapter.

  • access: public
Zend_Db_Select select ()
setFetchMode (line 536)

Set the fetch mode.

  • access: public
  • abstract:
void setFetchMode (integer $mode)
  • integer $mode

Redefined in descendants as:
update (line 240)

Updates table rows with specified data based on a WHERE clause.

  • return: The number of affected rows.
  • access: public
int update (string $table, array $bind, string $where)
  • string $table: The table to udpate.
  • array $bind: Column-value pairs.
  • string $where: UPDATE WHERE clause.

Redefined in descendants as:
_beginTransaction (line 516)

Begin a transaction.

  • access: protected
  • abstract:
void _beginTransaction ()

Redefined in descendants as:
_commit (line 522)

Commit a transaction.

  • access: protected
  • abstract:
void _commit ()

Redefined in descendants as:
_connect (line 491)

Creates a connection to the database.

  • access: protected
  • abstract:
void _connect ()

Redefined in descendants as:
_quote (line 483)

Quote a raw string.

  • return: Quoted string
  • access: protected
  • abstract:
string _quote (string $value)
  • string $value: Raw string

Redefined in descendants as:
_rollBack (line 528)

Roll-back a transaction.

  • access: protected
  • abstract:
void _rollBack ()

Redefined in descendants as:

Documentation generated on Thu, 18 Jan 2007 09:52:03 -0800 by phpDocumentor 1.3.1