$_config
$_config : array
Config options.
PDO_PostgreSQL Horde_Db_Adapter
$_schema : \Horde_Db_Adapter_Base_Schema
Schema object.
select(string $sql, mixed $arg1 = null, string $arg2 = null) : \Horde_Db_Adapter_Pdo_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) : \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. |
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 |
---|
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 |
---|
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 |
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 |
quoteString(string $string) : string
Quotes a string, escaping any ' (single quote) and \ (backslash) characters.
.
string | $string |
None found |
__construct(array $config)
Constructor.
array | $config | Configuration options and optional objects: 'charset' - (string) TODO |
None found |
None found |
None found |
None found |
getOption(string $option) : mixed
Returns an adaptor option set through the constructor.
string | $option | The option to return. |
The option value or null if option doesn't exist or is not set.
None found |
setCache(\Horde_Cache $cache)
Set a cache object.
\Horde_Cache | $cache | The cache object. |
inject |
---|
None found |
setLogger(\Horde_Log_Logger $logger, $log_queries = false)
Set a logger object.
\Horde_Log_Logger | $logger | |
$log_queries |
inject | |
---|---|
var |
The logger object. If true, logs all queries at DEBUG level. NOTE: Horde_Db_Value_Binary objects and stream resource values are NEVER included in the log output regardless of this setting. @since 2.4.0 |
None found |
__call(string $method, array $args) : mixed
Delegate calls to the schema object.
string | $method | |
array | $args |
TODO
None found |
supportsCountDistinct() : boolean
Does this adapter support using DISTINCT within COUNT? This is +true+ for all adapters except sqlite.
None found |
supportsInterval() : boolean
Does this adapter support using INTERVAL statements? This is +true+ for all adapters except sqlite.
None found |
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 |
None found |
None found |
None found |
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 |
---|
None found |
None found |
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 |
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 |
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 |
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 |
supportsStandardConformingStrings() : boolean
Does PostgreSQL support standard conforming strings?
None found |
_executePrepared(string $sql, array $values, array $binary_values)
Use a PDO prepared statement to execute a query. Used when passing values to insert/update as a stream resource.
string | $sql | The SQL statement. Includes '?' placeholder for binding non-stream values. Stream values are bound using a placeholders named like ':binary0', ':binary1' etc... |
array | $values | An array of non-stream values. |
array | $binary_values | An array of stream resources. |
None found |
None found |
None found |
_parseConfig() : array
Parse configuration array into options for PDO constructor.
[dsn, username, password]
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 |
_formatLogEntry(string $message, string $sql) : string
Formats the log entry.
string | $message | Message. |
string | $sql | SQL statment. |
Formatted log entry.
None found |
_cacheKey(string $key) : string
Returns the prefixed cache key to use.
string | $key | A cache key. |
Prefixed cache key.
None found |