$_config
$_config : array
Config options.
$_schema : \Horde_Db_Adapter_Base_Schema
Schema object.
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 |
cacheWrite(string $key, string $value)
Writes values to the cache handler.
The key is automatically prefixed to avoid collisions when using different adapters or different configurations.
string | $key | A cache key. |
string | $value | A value. |
since |
Horde_Db 2.1.0 |
---|
cacheRead(string $key) : string
Reads values from the cache handler.
The key is automatically prefixed to avoid collisions when using different adapters or different configurations.
string | $key | A cache key. |
A value.
since |
Horde_Db 2.1.0 |
---|
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.
None found |
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. |
None found |
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. |
None found |
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. |
None found |
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. |
None found |
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. |
None found |
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/CLOB columns must be provided as Horde_Db_Value 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.
since |
Horde_Db 2.1.0 |
---|
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.
None found |
updateBlob(string $table, array $fields, string|array $where = null)
Updates rows including BLOBs into a table.
string | $table | The table name. |
array | $fields | A hash of column names and values. BLOB/CLOB columns must be provided as Horde_Db_Value objects. |
string|array | $where | A WHERE clause. Either a complete clause or an array containing a clause with placeholders and a list of values. |
since |
Horde_Db 2.2.0 |
---|
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.
None found |
transactionStarted() : boolean
Check if a transaction has been started.
True if transaction has been started.
None found |
addLimitOffset(string $sql, array $options) : string
Appends LIMIT and OFFSET options to a SQL statement.
string | $sql | SQL statement. |
array | $options | Hash with 'limit' and (optional) 'offset' values. |
None found |
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. |
None found |
insertFixture(\TODO $fixture, \TODO $tableName) : \TODO
Inserts the given fixture into the table. Overridden in adapters that require something beyond a simple insert (eg. Oracle).
\TODO | $fixture | TODO |
\TODO | $tableName | TODO |
None found |
emptyInsertStatement(string $tableName) : string
TODO
string | $tableName | TODO |
TODO
None found |
_checkRequiredConfig(array $required)
Checks if required configuration keys are present.
array | $required | Required configuration keys. |
if a required key is missing.
None found |
_replaceParameters(string $sql, array $args, boolean $no_binary = false) : string
Replace ? in a SQL statement with quoted values from $args
string | $sql | SQL statement. |
array | $args | An array of values to bind. |
boolean | $no_binary | If true, do not replace any Horde_Db_Value_Binary values. Used for logging purposes. |
Modified SQL statement.
None found |
_logInfo(string $sql, array $values, string $name = null, float $runtime = null)
Logs the SQL query for debugging.
string | $sql | SQL statement. |
array | $values | An array of values to substitute for placeholders. |
string | $name | Optional queryname. |
float | $runtime | Runtime interval. |
None found |
None found |