PHP Класс Horde_Db_Adapter_Mysql, horde

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

Защищенные свойства (Protected)

Свойство Тип Описание
$_insertId integer Last auto-generated insert_id
$_schemaClass string

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

Метод Описание
adapterName ( ) : string Returns the human-readable name of the adapter. Use mixed case - one can always use downcase if needed.
beginDbTransaction ( ) Begins the transaction (and turns off auto-committing).
commitDbTransaction ( ) Commits the transaction (and turns on auto-committing).
connect ( ) Connect to the db
disconnect ( ) Disconnect from db
execute ( string $sql, mixed $arg1 = null, string $arg2 = null ) : resource Executes the SQL statement in the context of this connection.
insert ( string $sql, mixed $arg1 = null, string $arg2 = null, string $pk = null, integer $idValue = null, string $sequenceName = null ) Returns the last auto-generated ID from the affected 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_Mysql_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.
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: select_values("SELECT id FROM companies LIMIT 3") => [1,2,3]
supportsMigrations ( ) : boolean Does this adapter support migrations? Backend specific, as the abstract adapter always returns +false+.

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

Метод Описание
_errorCode ( string $sqlstate, integer $errno ) : integer Return a standard error code
_parseConfig ( ) : array Parse configuration array into options for mysql_connect

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

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

Return a standard error code
protected _errorCode ( string $sqlstate, integer $errno ) : integer
$sqlstate string
$errno integer
Результат integer

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

Parse configuration array into options for mysql_connect
protected _parseConfig ( ) : array
Результат array [host, username, password, dbname]

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

Returns the human-readable name of the adapter. Use mixed case - one can always use downcase if needed.
public adapterName ( ) : string
Результат string

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 ( )

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

Disconnect from db
public disconnect ( )

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 ) : resource
$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.
Результат resource

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

Returns the last auto-generated ID from the affected table.
public insert ( string $sql, mixed $arg1 = null, string $arg2 = null, string $pk = null, integer $idValue = null, string $sequenceName = 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.
$pk string
$idValue integer
$sequenceName string

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_Mysql_Result
$sql string
$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_Mysql_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.

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: select_values("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.

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

Does this adapter support migrations? Backend specific, as the abstract adapter always returns +false+.
public supportsMigrations ( ) : boolean
Результат boolean

Описание свойств

$_insertId защищенное свойство

Last auto-generated insert_id
protected int $_insertId
Результат integer

$_schemaClass защищенное свойство

protected string $_schemaClass
Результат string