PHP Class Pop\Db\Adapter\Pdo

Author: Nick Sagona, III ([email protected])
Inheritance: extends AbstractAdapter
Show file Open project: nicksagona/PopPHP

Protected Properties

Property Type Description
$database string Database
$dbtype string PDO DB Type
$dsn string PDO DSN
$placeholder string Statement placeholder
$statement PDOStatement Prepared statement

Public Methods

Method Description
__construct ( array $options ) : Pdo Constructor
bindParams ( array $params ) : Pdo Bind parameters to for a prepared SQL query.
disconnect ( ) : void Close the DB connection.
escape ( string $value ) : string Return the escaped string value.
execute ( ) : void Execute the prepared SQL query.
fetch ( ) : array Return the results array from the results resource.
fetchResult ( ) : array Fetch and return the values.
getDbtype ( ) : string Get PDO DB Type
getDsn ( ) : string Get PDO DSN
lastId ( ) : integer Return the auto-increment ID of the last query.
numFields ( ) : integer Return the number of fields in the result.
numRows ( ) : integer Return the number of rows in the result.
prepare ( string $sql, array $attribs = null ) : Pdo Prepare a SQL query.
query ( string $sql ) : void Execute the SQL query and create a result resource, or display the SQL error.
showError ( string $code = null, array $info = null ) : void Throw an exception upon a database error.
version ( ) : string Return the database version.

Protected Methods

Method Description
loadTables ( ) : array Get an array of the tables of the database.

Method Details

__construct() public method

Instantiate the PDO database connection object.
public __construct ( array $options ) : Pdo
$options array
return Pdo

bindParams() public method

Bind parameters to for a prepared SQL query.
public bindParams ( array $params ) : Pdo
$params array
return Pdo

disconnect() public method

Close the DB connection.
public disconnect ( ) : void
return void

escape() public method

Return the escaped string value.
public escape ( string $value ) : string
$value string
return string

execute() public method

Execute the prepared SQL query.
public execute ( ) : void
return void

fetch() public method

Return the results array from the results resource.
public fetch ( ) : array
return array

fetchResult() public method

Fetch and return the values.
public fetchResult ( ) : array
return array

getDbtype() public method

Get PDO DB Type
public getDbtype ( ) : string
return string

getDsn() public method

Get PDO DSN
public getDsn ( ) : string
return string

lastId() public method

Return the auto-increment ID of the last query.
public lastId ( ) : integer
return integer

loadTables() protected method

Get an array of the tables of the database.
protected loadTables ( ) : array
return array

numFields() public method

Return the number of fields in the result.
public numFields ( ) : integer
return integer

numRows() public method

Return the number of rows in the result.
public numRows ( ) : integer
return integer

prepare() public method

Prepare a SQL query.
public prepare ( string $sql, array $attribs = null ) : Pdo
$sql string
$attribs array
return Pdo

query() public method

Execute the SQL query and create a result resource, or display the SQL error.
public query ( string $sql ) : void
$sql string
return void

showError() public method

Throw an exception upon a database error.
public showError ( string $code = null, array $info = null ) : void
$code string
$info array
return void

version() public method

Return the database version.
public version ( ) : string
return string

Property Details

$database protected property

Database
protected string $database
return string

$dbtype protected property

PDO DB Type
protected string $dbtype
return string

$dsn protected property

PDO DSN
protected string $dsn
return string

$placeholder protected property

Statement placeholder
protected string $placeholder
return string

$statement protected property

Prepared statement
protected PDOStatement $statement
return PDOStatement