Overview

Namespaces

  • GAubry
    • ErrorHandler
    • Helpers
    • Logger
    • Shell
  • Himedia
    • Padocc
      • DB
      • Minifier
      • Numbering
      • Properties
      • Task
        • Base
        • Extended
  • None
  • Psr
    • Log

Classes

  • DeploymentMapper
  • PDOAdapter

Interfaces

  • DBAdapterInterface
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo

Class PDOAdapter

Himedia\Padocc\DB\PDOAdapter implements Himedia\Padocc\DB\DBAdapterInterface
Namespace: Himedia\Padocc\DB
Located at Himedia/Padocc/DB/PDOAdapter.php
Methods summary
public static Himedia\Padocc\DB\PDOAdapter
# getInstance( array $aDSN, string $sQueriesLogPath = '' )

Return a PDOAdapter instance. Lazy connection to backend PDO instance.

Return a PDOAdapter instance. Lazy connection to backend PDO instance.

Parameters

$aDSN
array
$aDSN Database source name: array( 'driver' => (string) e.g. 'pdo_mysql' ou 'pdo_pgsql', 'hostname' => (string), 'port' => (int), 'db_name' => (string), 'username' => (string), 'password' => (string) );
$sQueriesLogPath
string
$sQueriesLogPath path where to log all queries by DB

Returns

Himedia\Padocc\DB\PDOAdapter
public
# __construct( array $aDSN )

Constructor.

Constructor.

Parameters

$aDSN
array
$aDSN Database source name: array( 'driver' => (string) e.g. 'pdo_mysql' ou 'pdo_pgsql', 'hostname' => (string), 'port' => (int), 'db_name' => (string), 'username' => (string), 'password' => (string) );
public
# setPDOInstance( PDO $oPDO )

Set backend PDO instance.

Set backend PDO instance.

Parameters

$oPDO
PDO
$oPDO PDO instance

Throws

BadMethodCallException
iff backend PDO instance is already set.
private
# connect( )

Establishes the connection with the database and set backend PDO instance.

Establishes the connection with the database and set backend PDO instance.

public string
# fetchColumn( string $sQuery, integer $iColumnNumber = 0 )

Returns content of specified column of the first row of query's result.

Returns content of specified column of the first row of query's result.

Parameters

$sQuery
string
$sQuery Query to execute.
$iColumnNumber
integer
$iColumnNumber 0-indexed number of the column you wish to retrieve from the row. If no value is supplied, PDOStatement::fetchColumn() fetches the first column.

Returns

string
content of specified column of the first row of query's result

Implementation of

Himedia\Padocc\DB\DBAdapterInterface::fetchColumn()
public array
# fetchRow( string $sQuery )

Fetches the first row of of the specified SQL statement. The row is an array indexed by column name. If a result set row contains multiple columns with the same name, then returns only a single value per column name.

Fetches the first row of of the specified SQL statement. The row is an array indexed by column name. If a result set row contains multiple columns with the same name, then returns only a single value per column name.

Parameters

$sQuery
string
$sQuery Statement to execute.

Returns

array
returns the first row of of the specified SQL statement.

Implementation of

Himedia\Padocc\DB\DBAdapterInterface::fetchRow()
public array
# fetchAll( string $sQuery )

Returns an array containing all of the result set rows of the specified SQL statement. Each row is an array indexed by column name. If a result set row contains multiple columns with the same name, then returns only a single value per column name.

Returns an array containing all of the result set rows of the specified SQL statement. Each row is an array indexed by column name. If a result set row contains multiple columns with the same name, then returns only a single value per column name.

Parameters

$sQuery
string
$sQuery Statement to execute.

Returns

array
returns an array containing all of the remaining rows in the result set. The array represents each row as an array of column values.

Implementation of

Himedia\Padocc\DB\DBAdapterInterface::fetchAll()
public PDOStatement
# query( string $sQuery )

Executes the specified SQL statement, returning a result set as a PDOStatement object.

Executes the specified SQL statement, returning a result set as a PDOStatement object.

Parameters

$sQuery
string
$sQuery Statement to execute.

Returns

PDOStatement
a PDOStatement object

Throws

PDOException
on error

Implementation of

Himedia\Padocc\DB\DBAdapterInterface::query()
public integer
# exec( string $sQuery )

Execute an SQL statement and return the number of affected rows.

Execute an SQL statement and return the number of affected rows.

Parameters

$sQuery
string
$sQuery The SQL statement to prepare and execute.

Returns

integer
the number of rows that were modified or deleted by the SQL statement. If no rows were affected returns 0.

Throws

PDOException
on error

Implementation of

Himedia\Padocc\DB\DBAdapterInterface::exec()
public PDOStatement
# prepare( string $sQuery )

Prepares a statement for execution and returns a statement object.

Prepares a statement for execution and returns a statement object.

Emulated prepared statements does not communicate with the database server so prepare() does not check the statement.

Parameters

$sQuery
string
$sQuery SQL statement

Returns

PDOStatement
a PDOStatement object.

Throws

PDOException
if error

Implementation of

Himedia\Padocc\DB\DBAdapterInterface::prepare()
public
# executePreparedStatement( PDOStatement $oStatement, array $aValues )

Implementation of

Himedia\Padocc\DB\DBAdapterInterface::executePreparedStatement()
public string
# lastInsertId( string $sSequenceName = null )

Returns the ID of the last inserted row or sequence value.

Returns the ID of the last inserted row or sequence value.

Parameters

$sSequenceName
string
$sSequenceName [optional] Name of the sequence object from which the ID should be returned.

Returns

string
If a sequence name was not specified returns a string representing the row ID of the last row that was inserted into the database, else returns a string representing the last value retrieved from the specified sequence object.

Implementation of

Himedia\Padocc\DB\DBAdapterInterface::lastInsertId()
public string
# quote( string $sValue, integer $iType = Himedia\Padocc\DB\PDO::PARAM_STR )

Quotes a string for use in a query.

Quotes a string for use in a query.

Parameters

$sValue
string
$sValue The string to be quoted.
$iType
integer
$iType [optional] Provides a data type hint for drivers that have alternate quoting styles.

Returns

string
a quoted string that is theoretically safe to pass into an SQL statement. Returns FALSE if the driver does not support quoting in this way.

Implementation of

Himedia\Padocc\DB\DBAdapterInterface::quote()
public boolean
# beginTransaction( )

Initiates a transaction.

Initiates a transaction.

Returns

boolean
TRUE on success or FALSE on failure.

Implementation of

Himedia\Padocc\DB\DBAdapterInterface::beginTransaction()
public boolean
# rollBack( )

Rolls back a transaction.

Rolls back a transaction.

Returns

boolean
TRUE on success or FALSE on failure.

Implementation of

Himedia\Padocc\DB\DBAdapterInterface::rollBack()
public boolean
# commit( )

Commits a transaction.

Commits a transaction.

Returns

boolean
TRUE on success or FALSE on failure.

Implementation of

Himedia\Padocc\DB\DBAdapterInterface::commit()
public
# formatValue( mixed $mValue )

Implementation of

Himedia\Padocc\DB\DBAdapterInterface::formatValue()
Properties summary
private static array $aPDOInstances array()
#

List of backend \PDO instances indexed by DSN.

List of backend \PDO instances indexed by DSN.

private PDO $oPDO
#

Backend PDO instance.

Backend PDO instance.

See

Himedia\Padocc\DB\PDOAdapter::connect()
Himedia\Padocc\DB\PDOAdapter::setPDOInstance()
private array $aDSN
#

Database source name: array(
'driver' => (string) e.g. 'pdo_mysql', 'pdo_pgsql',
'hostname' => (string),
'port' => (int),
'db_name' => (string),
'username' => (string),
'password' => (string) );

Database source name: array( 'driver' => (string) e.g. 'pdo_mysql', 'pdo_pgsql', 'hostname' => (string), 'port' => (int), 'db_name' => (string), 'username' => (string), 'password' => (string) );

private static Himedia\Padocc\DB\PDOAdapter[] $aInstances array()
#

List of instances indexed by DSN.

List of instances indexed by DSN.

Platform for Automatized Deployments with pOwerful Concise Configuration API documentation generated by ApiGen 2.8.0