$_read
$_read : \Horde_Db_Adapter
The read adapter
The Horde_Db_Adapter_SplitRead:: class wraps two individual adapters to provide support for split read/write database setups.
$_read : \Horde_Db_Adapter
The read adapter
$_write : \Horde_Db_Adapter
The write adapter
__construct(\Horde_Db_Adapter $read, \Horde_Db_Adapter $write)
Const'r
\Horde_Db_Adapter | $read | |
\Horde_Db_Adapter | $write |
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.
This is false for all adapters but Firebird.
$tableName |
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.
string | $sql | SQL statement. |
mixed | $arg1 | Either an array of bound parameters or a query name. |
string | $arg2 | If $arg1 contains bound parameters, the query name. |
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.
string | $sql | SQL statement. |
mixed | $arg1 | Either an array of bound parameters or a query name. |
string | $arg2 | If $arg1 contains bound parameters, the query name. |
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.
string | $sql | SQL statement. |
mixed | $arg1 | Either an array of bound parameters or a query name. |
string | $arg2 | If $arg1 contains bound parameters, the query name. |
selectValue(string $sql, mixed $arg1 = null, string $arg2 = null) : string
Returns a single value from a record
string | $sql | SQL statement. |
mixed | $arg1 | Either an array of bound parameters or a query name. |
string | $arg2 | If $arg1 contains bound parameters, the query name. |
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]
string | $sql | SQL statement. |
mixed | $arg1 | Either an array of bound parameters or a query name. |
string | $arg2 | If $arg1 contains bound parameters, the query name. |
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:
selectAssoc("SELECT id, name FROM companies LIMIT 3") => [1 => 'Ford', 2 => 'GM', 3 => 'Chrysler']
string | $sql | SQL statement. |
mixed | $arg1 | Either an array of bound parameters or a query name. |
string | $arg2 | If $arg1 contains bound parameters, the query name. |
execute(string $sql, mixed $arg1 = null, string $arg2 = null) : \PDOStatement
Executes the SQL statement in the context of this connection.
string | $sql | SQL statement. |
mixed | $arg1 | Either an array of bound parameters or a query name. |
string | $arg2 | If $arg1 contains bound parameters, the query name. |
insert(string $sql, mixed $arg1 = null, string $arg2 = null, string $pk = null, mixed $idValue = null, string $sequenceName = null) : integer
Returns the last auto-generated ID from the affected table.
string | $sql | SQL statement. |
mixed | $arg1 | Either an array of bound parameters or a query name. |
string | $arg2 | If $arg1 contains bound parameters, the query name. |
string | $pk | TODO |
mixed | $idValue | TODO |
string | $sequenceName | TODO |
Last inserted ID.
insertBlob(string $table, array $fields, string $pk = null, mixed $idValue = null) : integer
Inserts a row including BLOBs into a table.
string | $table | The table name. |
array | $fields | A hash of column names and values. BLOB columns must be provided as Horde_Db_Value_Binary objects. |
string | $pk | The primary key column. |
mixed | $idValue | The primary key value. This parameter is required if the primary key is inserted manually. |
Last inserted ID.
update(string $sql, mixed $arg1 = null, string $arg2 = null) : integer
Executes the update statement and returns the number of rows affected.
string | $sql | SQL statement. |
mixed | $arg1 | Either an array of bound parameters or a query name. |
string | $arg2 | If $arg1 contains bound parameters, the query name. |
Number of rows affected.
updateBlob(string $table, array $fields, string $where = '')
Updates rows including BLOBs into a table.
string | $table | The table name. |
array | $fields | A hash of column names and values. BLOB columns must be provided as Horde_Db_Value_Binary objects. |
string | $where | A WHERE clause. |
delete(string $sql, mixed $arg1 = null, string $arg2 = null) : integer
Executes the delete statement and returns the number of rows affected.
string | $sql | SQL statement. |
mixed | $arg1 | Either an array of bound parameters or a query name. |
string | $arg2 | If $arg1 contains bound parameters, the query name. |
Number of rows affected.
addLock( $sql, array $options = array())
Appends a locking clause to an SQL statement.
This method modifies the +sql+ parameter.
add_lock! 'SELECT FROM suppliers', :lock => true add_lock! 'SELECT FROM suppliers', :lock => ' FOR UPDATE'
$sql | ||
array | $options | TODO. |