PHP 클래스 Horde_Db_Adapter_SplitRead, horde

저자: Mike Naberezny ([email protected])
저자: Derek DeVries ([email protected])
저자: Chuck Hagenbuch ([email protected])
저자: Michael J. Rubinsky ([email protected])
상속: implements Horde_Db_Adapter
파일 보기 프로젝트 열기: horde/horde

공개 메소드들

메소드 설명
__call ( string $method, array $args ) Delegate unknown methods to the _write adapter.
__construct ( Horde_Db_Adapter $read, Horde_Db_Adapter $write ) Const'r
adapterName ( ) : string Returns the human-readable name of the adapter. Use mixed case - one can always use downcase if needed.
addLimitOffset ( string $sql, array $options ) : string Appends +LIMIT+ and +OFFSET+ options to a SQL statement.
addLock ( &$sql, array $options = [] ) Appends a locking clause to an SQL statement.
beginDbTransaction ( ) Begins the transaction (and turns off auto-committing).
commitDbTransaction ( ) Commits the transaction (and turns on auto-committing).
connect ( ) Connect to the db.
delete ( string $sql, mixed $arg1 = null, string $arg2 = null ) : integer Executes the delete statement and returns the number of rows affected.
disconnect ( ) Disconnect from db.
execute ( string $sql, mixed $arg1 = null, string $arg2 = null ) : PDOStatement 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 ) : integer Returns the last auto-generated ID from the affected table.
insertBlob ( string $table, array $fields, string $pk = null, integer $idValue = null ) : integer Inserts a row including BLOBs into a table.
isActive ( ) : boolean Is the connection active?
prefetchPrimaryKey ( $tableName = null ) : boolean Should primary key values be selected from their corresponding sequence before the insert statement? If true, next_sequence_value is called before each insert to set the record's primary key.
quoteString ( string $string ) : string Quotes a string, escaping any special characters.
rawConnection ( ) : resource Provides access to the underlying database connection. Useful for when you need to call a proprietary method such as postgresql's lo_* methods.
reconnect ( ) Reconnect to the db.
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 ) : PDOStatement 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 ) : array 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 ) : array 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 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 ) : array Returns an array of the values of the first column in a select: selectValues("SELECT id FROM companies LIMIT 3") => [1,2,3]
supportsCountDistinct ( ) : boolean Does this adapter support using DISTINCT within COUNT? This is +true+ for all adapters except sqlite.
supportsMigrations ( ) : boolean Does this adapter support migrations?
transactionStarted ( ) : boolean Check if a transaction has been started.
update ( string $sql, mixed $arg1 = null, string $arg2 = null ) : integer Executes the update statement and returns the number of rows affected.
updateBlob ( string $table, array $fields, string $where = '' ) Updates rows including BLOBs into a table.

메소드 상세

__call() 공개 메소드

Delegate unknown methods to the _write adapter.
public __call ( string $method, array $args )
$method string
$args array

__construct() 공개 메소드

Const'r
public __construct ( Horde_Db_Adapter $read, Horde_Db_Adapter $write )
$read Horde_Db_Adapter
$write Horde_Db_Adapter

adapterName() 공개 메소드

Returns the human-readable name of the adapter. Use mixed case - one can always use downcase if needed.
public adapterName ( ) : string
리턴 string

addLimitOffset() 공개 메소드

Appends +LIMIT+ and +OFFSET+ options to a SQL statement.
public addLimitOffset ( string $sql, array $options ) : string
$sql string SQL statement.
$options array TODO
리턴 string

addLock() 공개 메소드

This method *modifies* the +sql+ parameter. # SELECT * FROM suppliers FOR UPDATE add_lock! 'SELECT * FROM suppliers', :lock => true add_lock! 'SELECT * FROM suppliers', :lock => ' FOR UPDATE'
public addLock ( &$sql, array $options = [] )
$options array TODO.

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

delete() 공개 메소드

Executes the delete statement and returns the number of rows affected.
public delete ( string $sql, mixed $arg1 = null, string $arg2 = null ) : integer
$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.
리턴 integer Number of rows affected.

disconnect() 공개 메소드

Disconnect from db.
public disconnect ( )

execute() 공개 메소드

Executes the SQL statement in the context of this connection.
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() 공개 메소드

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 ) : integer
$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.
$pk string TODO
$idValue integer TODO
$sequenceName string TODO
리턴 integer Last inserted ID.

insertBlob() 공개 메소드

Inserts a row including BLOBs into a table.
public insertBlob ( string $table, array $fields, string $pk = null, integer $idValue = null ) : integer
$table string The table name.
$fields array A hash of column names and values. BLOB columns must be provided as Horde_Db_Value_Binary objects.
$pk string The primary key column.
$idValue integer The primary key value. This parameter is required if the primary key is inserted manually.
리턴 integer Last inserted ID.

isActive() 공개 메소드

Is the connection active?
public isActive ( ) : boolean
리턴 boolean

prefetchPrimaryKey() 공개 메소드

This is false for all adapters but Firebird.
public prefetchPrimaryKey ( $tableName = null ) : boolean
리턴 boolean

quoteString() 공개 메소드

Quotes a string, escaping any special characters.
public quoteString ( string $string ) : string
$string string
리턴 string

rawConnection() 공개 메소드

Provides access to the underlying database connection. Useful for when you need to call a proprietary method such as postgresql's lo_* methods.
public rawConnection ( ) : resource
리턴 resource

reconnect() 공개 메소드

Reconnect to the db.
public reconnect ( )

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

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 ) : array
$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.
리턴 array

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 ) : array
$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.
리턴 array

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
$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.
리턴 array

selectValue() 공개 메소드

Returns a single value from a record
public selectValue ( string $sql, mixed $arg1 = null, string $arg2 = null ) : string
$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.
리턴 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 ) : array
$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.
리턴 array

supportsCountDistinct() 공개 메소드

Does this adapter support using DISTINCT within COUNT? This is +true+ for all adapters except sqlite.
public supportsCountDistinct ( ) : boolean
리턴 boolean

supportsMigrations() 공개 메소드

Does this adapter support migrations?
public supportsMigrations ( ) : boolean
리턴 boolean

transactionStarted() 공개 메소드

Check if a transaction has been started.
public transactionStarted ( ) : boolean
리턴 boolean True if transaction has been started.

update() 공개 메소드

Executes the update statement and returns the number of rows affected.
public update ( string $sql, mixed $arg1 = null, string $arg2 = null ) : integer
$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.
리턴 integer Number of rows affected.

updateBlob() 공개 메소드

Updates rows including BLOBs into a table.
public updateBlob ( string $table, array $fields, string $where = '' )
$table string The table name.
$fields array A hash of column names and values. BLOB columns must be provided as Horde_Db_Value_Binary objects.
$where string A WHERE clause.