Methods summary
public
string
|
#
adapterName( )
Returns the human-readable name of the adapter. Use mixed case - one
can always use downcase if needed.
Returns the human-readable name of the adapter. Use mixed case - one
can always use downcase if needed.
Returns
string
Overrides
|
public
boolean
|
#
supportsMigrations( )
Does this adapter support migrations? Backend specific, as the
abstract adapter always returns +false+.
Does this adapter support migrations? Backend specific, as the
abstract adapter always returns +false+.
Returns
boolean
Overrides
|
public
|
#
connect( )
Connect to the db
MySQLi can connect using SSL if $config contains an 'ssl' sub-array
containing the following keys: + key The path to the key file. + cert The path to the certificate file. + ca The path to the certificate authority file. + capath The path to a directory that contains trusted SSL CA certificates in pem format. + cipher The list of allowable ciphers for SSL encryption.
Example of how to connect using SSL:
$config = array(
'username' => 'someuser',
'password' => 'apasswd',
'hostspec' => 'localhost',
'database' => 'thedb',
'ssl' => array(
'key' => 'client-key.pem',
'cert' => 'client-cert.pem',
'ca' => 'cacert.pem',
'capath' => '/path/to/ca/dir',
'cipher' => 'AES',
),
);
$db = new Horde_Db_Adapter_Mysqli($config);
|
public
|
|
public
boolean
|
#
isActive( )
Check if the connection is active
Check if the connection is active
Returns
boolean
Overrides
|
public
string
|
#
quoteString( string $string )
Quotes a string, escaping any ' (single quote) and \ (backslash)
characters..
Quotes a string, escaping any ' (single quote) and \ (backslash)
characters..
Parameters
Returns
string
|
public
array
|
#
select( string $sql, mixed $arg1 = null, string $arg2 = null )
Returns an array of records with the column names as keys, and
column values as values.
Returns an array of records with the column names as keys, and
column values as values.
Parameters
- $sql
-
- $arg1
- Either an array of bound parameters or a query name.
- $arg2
- If $arg1 contains bound parameters, the query name.
Returns
array
Throws
Overrides
|
public
array
|
#
selectAll( string $sql, mixed $arg1 = null, string $arg2 = null )
Returns an array of record hashes with the column names as keys and
column values as values.
Returns an array of record hashes with the column names as keys and
column values as values.
Parameters
- $sql
-
- $arg1
- Either an array of bound parameters or a query name.
- $arg2
- If $arg1 contains bound parameters, the query name.
Returns
array
Throws
Overrides
|
public
array|boolean
|
#
selectOne( string $sql, mixed $arg1 = null, string $arg2 = null )
Returns a record hash with the column names as keys and column values as
values.
Returns a record hash with the column names as keys and column values as
values.
Parameters
- $sql
- A query.
- $arg1
- Either an array of bound parameters or a query name.
- $arg2
- If $arg1 contains bound parameters, the query name.
Returns
array|boolean A record hash or false if no record found.
Throws
Overrides
|
public
string
|
#
selectValue( string $sql, mixed $arg1 = null, string $arg2 = null )
Returns a single value from a record
Returns a single value from a record
Parameters
- $sql
-
- $arg1
- Either an array of bound parameters or a query name.
- $arg2
- If $arg1 contains bound parameters, the query name.
Returns
string
Throws
Overrides
|
public
array
|
#
selectValues( string $sql, mixed $arg1 = null, string $arg2 = null )
Returns an array of the values of the first column in a select:
select_values("SELECT id FROM companies LIMIT 3") => [1,2,3]
Returns an array of the values of the first column in a select: select_values("SELECT id FROM companies LIMIT 3") => [1,2,3]
Parameters
- $sql
-
- $arg1
- Either an array of bound parameters or a query name.
- $arg2
- If $arg1 contains bound parameters, the query name.
Returns
array
Throws
Overrides
|
public
PDOStatement
|
#
execute( string $sql, mixed $arg1 = null, string $arg2 = null )
Executes the SQL statement in the context of this connection.
Executes the SQL statement in the context of this connection.
Parameters
- $sql
-
- $arg1
- Either an array of bound parameters or a query name.
- $arg2
- If $arg1 contains bound parameters, the query name.
Returns
PDOStatement
Throws
Overrides
|
public
integer
|
#
insert( string $sql, mixed $arg1 = null, string $arg2 = null, string $pk = null, integer $idValue = null, string $sequenceName = null )
Returns the last auto-generated ID from the affected table.
Returns the last auto-generated ID from the affected table.
Parameters
- $sql
-
- $arg1
- Either an array of bound parameters or a query name.
- $arg2
- If $arg1 contains bound parameters, the query name.
- $pk
-
- $idValue
-
- $sequenceName
-
Returns
integer Last inserted ID.
Throws
Overrides
|
public
|
#
beginDbTransaction( )
Begins the transaction (and turns off auto-committing).
Begins the transaction (and turns off auto-committing).
Overrides
|
public
|
#
commitDbTransaction( )
Commits the transaction (and turns on auto-committing).
Commits the transaction (and turns on auto-committing).
Overrides
|
public
|
#
rollbackDbTransaction( )
Rolls back the transaction (and turns on auto-committing). Must be
done if the transaction block raises an exception or returns false.
Rolls back the transaction (and turns on auto-committing). Must be
done if the transaction block raises an exception or returns false.
Overrides
|