PhpLight
[ class tree: PhpLight ] [ index: PhpLight ] [ all elements ]

Class: PhpLight_Db_Adapter_Abstract

Source Location: /Db/Adapter/Abstract.php

Class Overview


Based on Zend_Db_Adapter_Abstract - Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)


Author(s):

Variables

Methods


Child classes:

PhpLight_Db_Adapter_Mysql
Based on Zend Framework MySQL adapter
PhpLight_Db_Adapter_Mysqli
Mysqli database adapter

Class Details

[line 21]
Based on Zend_Db_Adapter_Abstract - Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)



Tags:

abstract:  


[ Top ]


Class Variables

$_config = array()

[line 28]

User-provided configuration



Tags:

access:  protected

Type:   array


[ Top ]

$_connection =

[line 35]

Database connection



Tags:

access:  protected

Type:   object|resource|null


[ Top ]



Class Methods


constructor __construct [line 50]

PhpLight_Db_Adapter_Abstract __construct( array $config)

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 username => (string) Connect to the database as this username. password => (string) Password associated with the username. host => (string) What host to connect to, defaults to localhost




Tags:

throws:  PhpLight_Db_Adapter_Exception
access:  public


Parameters:

array   $config   An array or instance of PhpLight_Config having configuration data

[ Top ]

method beginTransaction [line 139]

Zend_Db_Adapter_Abstract beginTransaction( )

Leave autocommit mode and begin a transaction.



Tags:

access:  public


[ Top ]

method commit [line 151]

Zend_Db_Adapter_Abstract commit( )

Commit a transaction and return to autocommit mode.



Tags:

access:  public


[ Top ]

method fetchAll [line 177]

array fetchAll( string $sql, [ $binds = array()])

Fetches all SQL result rows as a sequential array.



Tags:

access:  public


Parameters:

string   $sql   An SQL SELECT statement.
array   $binds   Data to bind into SELECT placeholders.

[ Top ]

method fetchAssoc [line 212]

array fetchAssoc( string $sql, [ $binds = array()])

Fetches all SQL result rows as an associative array.

The first column is the key, the entire row array is the value. You should construct the query to be sure that the first column contains unique values, or else rows with duplicate values in the first column will overwrite previous data.




Tags:

access:  public


Parameters:

string   $sql   An SQL SELECT statement.
array   $binds   Data to bind into SELECT placeholders.

[ Top ]

method fetchOne [line 230]

string fetchOne( string $sql, [ $binds = array()])

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



Tags:

access:  public


Parameters:

string   $sql   An SQL SELECT statement.
array   $binds   Data to bind into SELECT placeholders.

[ Top ]

method fetchRow [line 192]

array fetchRow( string $sql, [ $binds = array()])

Fetches the first row of the SQL result.



Tags:

access:  public


Parameters:

string   $sql   An SQL SELECT statement.
array   $binds   Data to bind into SELECT placeholders.

[ Top ]

method getConfig [line 105]

array getConfig( )

Returns the configuration variables in this adapter.



Tags:

access:  public


[ Top ]

method getConnection [line 94]

object|resource|null getConnection( )

Returns the underlying database connection object or resource.

If not presently connected, this initiates the connection.




Tags:

access:  public


[ Top ]

method isConnected [line 267]

boolean isConnected( )

Test if a connection is active



Tags:

abstract:  
access:  public


Overridden in child classes as:

PhpLight_Db_Adapter_Mysql::isConnected()
Test if a connection is active
PhpLight_Db_Adapter_Mysqli::isConnected()
Test if a connection is active

[ Top ]

method prepare [line 275]

PhpLight_Db_Statement_Abstract prepare( string $sql)

Prepare a statement and return a PDOStatement-like object.



Tags:

abstract:  
access:  public


Overridden in child classes as:

PhpLight_Db_Adapter_Mysql::prepare()
Prepare a statement and return a PDOStatement-like object.
PhpLight_Db_Adapter_Mysqli::prepare()
Prepare a statement and return a PDOStatement-like object.

Parameters:

string   $sql   SQL query

[ Top ]

method query [line 117]

PhpLight_Db_Statement_Interface query( string $sql, [ $binds = array()])

Prepares and executes an SQL statement with bound data.



Tags:

access:  public


Parameters:

string   $sql   The SQL statement with placeholders.
array   $binds   An array of data to bind to the placeholders.

[ Top ]

method rollBack [line 163]

Zend_Db_Adapter_Abstract rollBack( )

Roll back a transaction and return to autocommit mode.



Tags:

access:  public


[ Top ]

method _beginTransaction [line 280]

void _beginTransaction( )

Begin a transaction.



Tags:

abstract:  
access:  protected


Overridden in child classes as:

PhpLight_Db_Adapter_Mysql::_beginTransaction()
Begin a transaction.
PhpLight_Db_Adapter_Mysqli::_beginTransaction()
Begin a transaction.

[ Top ]

method _checkRequiredOptions [line 72]

void _checkRequiredOptions( $config)

Check for config options that are mandatory.

Throw exceptions if any are missing.




Tags:

throws:  PhpLight_Db_Adapter_Exception
access:  protected


Parameters:

array   $config  

[ Top ]

method _commit [line 285]

void _commit( )

Commit a transaction.



Tags:

abstract:  
access:  protected


Overridden in child classes as:

PhpLight_Db_Adapter_Mysql::_commit()
Commit a transaction.
PhpLight_Db_Adapter_Mysqli::_commit()
Commit a transaction.

[ Top ]

method _connect [line 260]

void _connect( )

Creates a connection to the database.



Tags:

abstract:  
access:  protected


Overridden in child classes as:

PhpLight_Db_Adapter_Mysql::_connect()
Creates a connection to the database.
PhpLight_Db_Adapter_Mysqli::_connect()
Creates a connection to the database.

[ Top ]

method _quote [line 245]

string _quote( string $value)

Quote a raw string.



Tags:

return:  Quoted string
access:  protected


Overridden in child classes as:

PhpLight_Db_Adapter_Mysql::_quote()
Quote a raw string.
PhpLight_Db_Adapter_Mysqli::_quote()
Quote a raw string.

Parameters:

string   $value   Raw string

[ Top ]

method _rollBack [line 290]

void _rollBack( )

Roll-back a transaction.



Tags:

abstract:  
access:  protected


Overridden in child classes as:

PhpLight_Db_Adapter_Mysql::_rollBack()
Roll-back a transaction.
PhpLight_Db_Adapter_Mysqli::_rollBack()
Roll-back a transaction.

[ Top ]


Documentation generated on Fri, 07 Oct 2011 08:06:18 +0300 by phpDocumentor 1.4.3