Class Database_PDO_Common

Description

PDO Abstraction Layer

Parent class for any of our database classes that use PDO.

Located in /classes/Database/PDO/Common.php (line 23)

Object
   |
   --Database_Common
      |
      --Database_PDO_Common
Direct descendents
Class Description
Database_PDO_MySQL MySQL Database Abstraction Layer
Database_PDO_SQLite SQLite Database Abstraction Layer
Database_PDO_PostgreSQL PostgreSQL Database Abstraction Layer
Variable Summary
string $attributes
string $dsn
Method Summary
Database_PDO_Common __construct ()
boolean close ()
integer execute (string $sql, [array $input_parameters = null])
mixed fetch ([string $sql = null], [array $input_parameters = null], [string $return_type = null])
array fetchAll ([string $sql = null], [array $input_parameters = null])
string fetchColumn ([string $sql = null], [array $input_parameters = null])
boolean open ()
Variables
string $attributes = array(
PDO::ATTR_PERSISTENT => true,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::NULL_EMPTY_STRING => true
)
(line 39)

PDO Attributes

  • access: protected
string $dsn (line 31)

DSN format

  • access: protected

Redefined in descendants as:

Inherited Variables

Inherited from Database_Common

Database_Common::$connection
Database_Common::$database
Database_Common::$driver
Database_Common::$hostname
Database_Common::$password
Database_Common::$port
Database_Common::$results
Database_Common::$socket
Database_Common::$username

Inherited from Object

Object::$config
Object::$instances
Methods
Constructor __construct (line 48)

Constructor

  • access: public
Database_PDO_Common __construct ()

Redefinition of:
Database_Common::__construct()
Constructor
close (line 107)

Closes database connection

Sets the connection to null regardless of state.

  • return: always true
  • access: public
boolean close ()

Redefinition of:
Database_Common::close()
Closes database connection
execute (line 124)

Executes an SQL Statement

Executes a standard or prepared query based on passed parameters. All queries are logged to a file as well as timed and logged in the execution time is over 1 second.

  • return: ID of the last inserted row or sequence number
  • access: public
integer execute (string $sql, [array $input_parameters = null])
  • string $sql: statement to execute
  • array $input_parameters: optional key/values to be bound
fetch (line 206)

Fetch a single row from the database

  • return: based on return type
  • access: public
mixed fetch ([string $sql = null], [array $input_parameters = null], [string $return_type = null])
  • string $sql: statement to be executed
  • array $input_parameters: optional key/values to be bound
  • string $return_type: optional type of return set
fetchAll (line 255)

Fetches all rows as an array

  • access: public
array fetchAll ([string $sql = null], [array $input_parameters = null])
  • string $sql: statement to be executed
  • array $input_parameters: optional key/values to be bound
fetchColumn (line 243)

Fetch a single column from the database

This method assumes you want the first column in your select. If you need 2 or more columns you should simply use fetch().

  • access: public
string fetchColumn ([string $sql = null], [array $input_parameters = null])
  • string $sql: statement to be executed
  • array $input_parameters: optional key/values to be bound
open (line 67)

Opens database connection

Establishes a connection to the database based on the set configuration options.

  • return: true on success, throws an exception overwise
  • access: public
boolean open ()

Redefinition of:
Database_Common::open()
Opens database connection

Inherited Methods

Inherited From Database_Common

Database_Common::__construct()
Database_Common::close()
Database_Common::open()
Database_Common::setDatabase()
Database_Common::setHostname()
Database_Common::setPassword()
Database_Common::setPort()
Database_Common::setSocket()
Database_Common::setUsername()

Inherited From Object

Object::__construct()
Object::getInstance()
Object::__destruct()

Documentation generated on Sun, 17 Oct 2010 23:17:22 -0400 by phpDocumentor 1.4.3