PHP Класс Horde_Db_Adapter_Pdo_Base, horde

Автор: Mike Naberezny ([email protected])
Автор: Derek DeVries ([email protected])
Автор: Chuck Hagenbuch ([email protected])
Наследование: extends Horde_Db_Adapter_Base
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
beginDbTransaction ( ) Begins the transaction (and turns off auto-committing).
commitDbTransaction ( ) Commits the transaction (and turns on auto-committing).
connect ( ) Connect to the db
execute ( string $sql, mixed $arg1 = null, string $arg2 = null ) : PDOStatement Executes the SQL statement in the context of this connection.
insert ( string $sql, array | string $arg1 = null, string $arg2 = null, string $pk = null, integer $idValue = null, string $sequenceName = null ) : integer Inserts a row into a table.
isActive ( ) : boolean Check if the connection is active
quoteString ( string $string ) : string Quotes a string, escaping any ' (single quote) and \ (backslash) characters.
rollbackDbTransaction ( ) Rolls back the transaction (and turns on auto-committing). Must be done if the transaction block raises an exception or returns false.
select ( string $sql, mixed $arg1 = null, string $arg2 = null ) : Horde_Db_Adapter_Pdo_Result Returns an array of records with the column names as keys, and column values as values.
selectAll ( string $sql, mixed $arg1 = null, string $arg2 = null ) Returns an array of record hashes with the column names as keys and column values as values.
selectAssoc ( string $sql, mixed $arg1 = null, string $arg2 = null ) Returns an array where the keys are the first column of a select, and the values are the second column:
selectOne ( string $sql, mixed $arg1 = null, string $arg2 = null ) : array | boolean Returns a record hash with the column names as keys and column values as values.
selectValue ( string $sql, mixed $arg1 = null, string $arg2 = null ) : string Returns a single value from a record
selectValues ( string $sql, mixed $arg1 = null, string $arg2 = null ) Returns an array of the values of the first column in a select: selectValues("SELECT id FROM companies LIMIT 3") => [1,2,3]

Защищенные методы

Метод Описание
_buildDsnString ( $params )
_normalizeConfig ( $params ) *########################################################################## # Protected ##########################################################################
_parseConfig ( ) : array Parse configuration array into options for PDO constructor.

Описание методов

_buildDsnString() защищенный Метод

protected _buildDsnString ( $params )

_normalizeConfig() защищенный Метод

*########################################################################## # Protected ##########################################################################
protected _normalizeConfig ( $params )

_parseConfig() защищенный Метод

Parse configuration array into options for PDO constructor.
protected _parseConfig ( ) : array
Результат array [dsn, username, password]

beginDbTransaction() публичный Метод

Begins the transaction (and turns off auto-committing).
public beginDbTransaction ( )

commitDbTransaction() публичный Метод

Commits the transaction (and turns on auto-committing).
public commitDbTransaction ( )

connect() публичный Метод

Connect to the db
public connect ( )

execute() публичный Метод

Executes the SQL statement in the context of this connection.
Устаревший: Deprecated for external usage. Use select() instead.
public execute ( string $sql, mixed $arg1 = null, string $arg2 = null ) : PDOStatement
$sql string SQL statement.
$arg1 mixed Either an array of bound parameters or a query name.
$arg2 string If $arg1 contains bound parameters, the query name.
Результат PDOStatement

insert() публичный Метод

Inserts a row into a table.
public insert ( string $sql, array | string $arg1 = null, string $arg2 = null, string $pk = null, integer $idValue = null, string $sequenceName = null ) : integer
$sql string SQL statement.
$arg1 array | string Either an array of bound parameters or a query name.
$arg2 string If $arg1 contains bound parameters, the query name.
$pk string The primary key column.
$idValue integer The primary key value. This parameter is required if the primary key is inserted manually.
$sequenceName string The sequence name.
Результат integer Last inserted ID.

isActive() публичный Метод

Check if the connection is active
public isActive ( ) : boolean
Результат boolean

quoteString() публичный Метод

.
public quoteString ( string $string ) : string
$string string
Результат string

rollbackDbTransaction() публичный Метод

Rolls back the transaction (and turns on auto-committing). Must be done if the transaction block raises an exception or returns false.

select() публичный Метод

Returns an array of records with the column names as keys, and column values as values.
public select ( string $sql, mixed $arg1 = null, string $arg2 = null ) : Horde_Db_Adapter_Pdo_Result
$sql string SQL statement.
$arg1 mixed Either an array of bound parameters or a query name.
$arg2 string If $arg1 contains bound parameters, the query name.
Результат Horde_Db_Adapter_Pdo_Result

selectAll() публичный Метод

Returns an array of record hashes with the column names as keys and column values as values.
public selectAll ( string $sql, mixed $arg1 = null, string $arg2 = null )
$sql string
$arg1 mixed Either an array of bound parameters or a query name.
$arg2 string If $arg1 contains bound parameters, the query name.

selectAssoc() публичный Метод

selectAssoc("SELECT id, name FROM companies LIMIT 3") => [1 => 'Ford', 2 => 'GM', 3 => 'Chrysler']
public selectAssoc ( string $sql, mixed $arg1 = null, string $arg2 = null )
$sql string
$arg1 mixed Either an array of bound parameters or a query name.
$arg2 string If $arg1 contains bound parameters, the query name.

selectOne() публичный Метод

Returns a record hash with the column names as keys and column values as values.
public selectOne ( string $sql, mixed $arg1 = null, string $arg2 = null ) : array | boolean
$sql string A query.
$arg1 mixed Either an array of bound parameters or a query name.
$arg2 string If $arg1 contains bound parameters, the query name.
Результат array | boolean A record hash or false if no record found.

selectValue() публичный Метод

Returns a single value from a record
public selectValue ( string $sql, mixed $arg1 = null, string $arg2 = null ) : string
$sql string
$arg1 mixed Either an array of bound parameters or a query name.
$arg2 string If $arg1 contains bound parameters, the query name.
Результат string

selectValues() публичный Метод

Returns an array of the values of the first column in a select: selectValues("SELECT id FROM companies LIMIT 3") => [1,2,3]
public selectValues ( string $sql, mixed $arg1 = null, string $arg2 = null )
$sql string
$arg1 mixed Either an array of bound parameters or a query name.
$arg2 string If $arg1 contains bound parameters, the query name.