adapterName()
adapterName() : string
Returns the human-readable name of the adapter. Use mixed case - one can always use downcase if needed.
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) : \Horde_Db_Adapter_Base_Result
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) : mixed
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, array|string $arg1 = null, string $arg2 = null, string $pk = null, mixed $idValue = null, string $sequenceName = null) : integer
Inserts a row into a table.
string | $sql | SQL statement. |
array|string | $arg1 | Either an array of bound parameters or a query name. |
string | $arg2 | If $arg1 contains bound parameters, the query name. |
string | $pk | The primary key column. |
mixed | $idValue | The primary key value. This parameter is required if the primary key is inserted manually. |
string | $sequenceName | The sequence name. |
Last inserted ID.
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 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.
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 $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. |
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 |
None found |
None found |
rollbackDbTransaction()
Rolls back the transaction (and turns on auto-committing). Must be done if the transaction block raises an exception or returns false.
None found |
addLimitOffset(string $sql, array $options) : string
Appends +LIMIT+ and +OFFSET+ options to a SQL statement.
string | $sql | SQL statement. |
array | $options | TODO |
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 |