ILIAS
eassessment Revision 61809
|
Public Member Functions | |
__construct () | |
Constructor. | |
MDB2_Driver_Common () | |
PHP 4 Constructor. | |
__destruct () | |
Destructor. | |
free () | |
Free the internal references so that the instance can be destroyed. | |
__toString () | |
String conversation. | |
errorInfo ($error=null) | |
This method is used to collect information about an error. | |
& | raiseError ($code=null, $mode=null, $options=null, $userinfo=null, $method=null) |
This method is used to communicate an error and invoke error callbacks etc. | |
resetWarnings () | |
reset the warning array | |
getWarnings () | |
Get all warnings in reverse order. | |
setFetchMode ($fetchmode, $object_class= 'stdClass') | |
Sets which fetch mode should be used by default on queries on this connection. | |
setOption ($option, $value) | |
set the option for the db class | |
getOption ($option) | |
Returns the value of an option. | |
debug ($message, $scope= '', $context=array()) | |
set a debug message | |
getDebugOutput () | |
output debug info | |
escape ($text, $escape_wildcards=false) | |
Quotes a string so it can be safely used in a query. | |
escapePattern ($text) | |
Quotes pattern (% and _) characters in a string) | |
quoteIdentifier ($str, $check_option=false) | |
Quote a string so it can be safely used as a table or column name. | |
getAsKeyword () | |
Gets the string to alias column. | |
getConnection () | |
Returns a native connection. | |
_fixResultArrayValues (&$row, $mode) | |
Do all necessary conversions on result arrays to fix DBMS quirks. | |
& | loadModule ($module, $property=null, $phptype_specific=null) |
loads a module | |
__call ($method, $params) | |
Calls a module method using the __call magic method. | |
beginTransaction ($savepoint=null) | |
Start a transaction or set a savepoint. | |
commit ($savepoint=null) | |
Commit the database changes done during a transaction that is in progress or release a savepoint. | |
rollback ($savepoint=null) | |
Cancel any database changes done during a transaction or since a specific savepoint that is in progress. | |
inTransaction ($ignore_nested=false) | |
If a transaction is currently open. | |
setTransactionIsolation ($isolation, $options=array()) | |
Set the transacton isolation level. | |
beginNestedTransaction () | |
Start a nested transaction. | |
completeNestedTransaction ($force_rollback=false) | |
Finish a nested transaction by rolling back if an error occured or committing otherwise. | |
failNestedTransaction ($error=null, $immediately=false) | |
Force setting nested transaction to failed. | |
getNestedTransactionError () | |
The first error that occured since the transaction start. | |
connect () | |
Connect to the database. | |
setCharset ($charset, $connection=null) | |
Set the charset on the current connection. | |
disconnect ($force=true) | |
Log out and disconnect from the database. | |
setDatabase ($name) | |
Select a different database. | |
getDatabase () | |
Get the current database. | |
setDSN ($dsn) | |
set the DSN | |
getDSN ($type= 'string', $hidepw=false) | |
return the DSN as a string | |
& | standaloneQuery ($query, $types=null, $is_manip=false) |
execute a query as database administrator | |
_modifyQuery ($query, $is_manip, $limit, $offset) | |
Changes a query string for various DBMS specific reasons. | |
& | _doQuery ($query, $is_manip=false, $connection=null, $database_name=null) |
Execute a query. | |
_affectedRows ($connection, $result=null) | |
Returns the number of rows affected. | |
& | exec ($query) |
Execute a manipulation query to the database and return the number of affected rows. | |
& | query ($query, $types=null, $result_class=true, $result_wrap_class=false) |
Send a query to the database and return any results. | |
& | _wrapResult ($result, $types=array(), $result_class=true, $result_wrap_class=false, $limit=null, $offset=null) |
wrap a result set into the correct class | |
getServerVersion ($native=false) | |
return version information about the server | |
setLimit ($limit, $offset=null) | |
set the range of the next query | |
subSelect ($query, $type=false) | |
simple subselect emulation: leaves the query untouched for all RDBMS that support subselects | |
replace ($table, $fields) | |
Execute a SQL REPLACE query. | |
& | prepare ($query, $types=null, $result_types=null, $lobs=array()) |
Prepares a query for multiple execution with execute(). | |
_skipDelimitedStrings ($query, $position, $p_position) | |
Utility method, used by prepare() to avoid replacing placeholders within delimited strings. | |
quote ($value, $type=null, $quote=true, $escape_wildcards=false) | |
Convert a text value into a DBMS specific format that is suitable to compose query statements. | |
getDeclaration ($type, $name, $field) | |
Obtain DBMS specific SQL code portion needed to declare of the given type. | |
compareDefinition ($current, $previous) | |
Obtain an array of changes that may need to applied. | |
supports ($feature) | |
Tell whether a DB implementation or its backend extension supports a given feature. | |
getSequenceName ($sqn) | |
adds sequence name formatting to a sequence name | |
getIndexName ($idx) | |
adds index name formatting to a index name | |
nextID ($seq_name, $ondemand=true) | |
Returns the next free id of a sequence. | |
lastInsertID ($table=null, $field=null) | |
Returns the autoincrement ID if supported or $id or fetches the current ID in a sequence called: $table. | |
currID ($seq_name) | |
Returns the current id of a sequence. | |
queryOne ($query, $type=null, $colnum=0) | |
Execute the specified query, fetch the value from the first column of the first row of the result set and then frees the result set. | |
queryRow ($query, $types=null, $fetchmode=MDB2_FETCHMODE_DEFAULT) | |
Execute the specified query, fetch the values from the first row of the result set into an array and then frees the result set. | |
queryCol ($query, $type=null, $colnum=0) | |
Execute the specified query, fetch the value from the first column of each row of the result set into an array and then frees the result set. | |
queryAll ($query, $types=null, $fetchmode=MDB2_FETCHMODE_DEFAULT, $rekey=false, $force_array=false, $group=false) | |
Execute the specified query, fetch all the rows of the result set into a two dimensional array and then frees the result set. | |
Public Member Functions inherited from PEAR | |
PEAR ($error_class=null) | |
Constructor. | |
_PEAR () | |
Destructor (the emulated type of...). | |
& | getStaticProperty ($class, $var) |
If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them. | |
registerShutdownFunc ($func, $args=array()) | |
Use this function to register a shutdown method for static classes. | |
isError ($data, $code=null) | |
Tell whether a value is a PEAR error. | |
setErrorHandling ($mode=null, $options=null) | |
Sets how errors generated by this object should be handled. | |
expectError ($code= '*') | |
This method is used to tell which errors you expect to get. | |
popExpect () | |
This method pops one element off the expected error codes stack. | |
_checkDelExpect ($error_code) | |
This method checks unsets an error code if available. | |
delExpect ($error_code) | |
This method deletes all occurences of the specified element from the expected error codes stack. | |
& | raiseError ($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false) |
This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied. | |
& | throwError ($message=null, $code=null, $userinfo=null) |
Simpler form of raiseError with fewer options. | |
staticPushErrorHandling ($mode, $options=null) | |
staticPopErrorHandling () | |
pushErrorHandling ($mode, $options=null) | |
Push a new error handler on top of the error handler options stack. | |
popErrorHandling () | |
Pop the last error handler used. | |
loadExtension ($ext) | |
OS independant PHP extension load. |
Data Fields | |
$db_index = 0 | |
$dsn = array() | |
$connected_dsn = array() | |
$connection = 0 | |
$opened_persistent | |
$database_name = '' | |
$connected_database_name = '' | |
$connected_server_info = '' | |
$supported | |
$options | |
$string_quoting = array('start' => "'", 'end' => "'", 'escape' => false, 'escape_pattern' => false) | |
$identifier_quoting = array('start' => '"', 'end' => '"', 'escape' => '"') | |
$sql_comments | |
$wildcards = array('%', '_') | |
$as_keyword = ' AS ' | |
$warnings = array() | |
$debug_output = '' | |
$in_transaction = false | |
$nested_transaction_counter = null | |
$has_transaction_error = false | |
$offset = 0 | |
$limit = 0 | |
$phptype | |
$dbsyntax | |
$last_query | |
$fetchmode = MDB2_FETCHMODE_ORDERED | |
$modules = array() | |
$destructor_registered = true | |
Data Fields inherited from PEAR | |
$_debug = false | |
$_default_error_mode = null | |
$_default_error_options = null | |
$_default_error_handler = '' | |
$_error_class = 'PEAR_Error' | |
$_expected_errors = array() |
MDB2_Driver_Common::__construct | ( | ) |
Constructor.
Reimplemented in MDB2_Driver_mysql, and MDB2_Driver_oci8.
Definition at line 1296 of file MDB2.php.
References $db_index, and $GLOBALS.
Referenced by MDB2_Driver_Common().
MDB2_Driver_Common::__destruct | ( | ) |
Destructor.
Definition at line 1322 of file MDB2.php.
References disconnect().
MDB2_Driver_Common::__call | ( | $method, | |
$params | |||
) |
Calls a module method using the __call magic method.
string | Method name. |
array | Arguments. |
Definition at line 1909 of file MDB2.php.
References PEAR\isError(), and loadModule().
MDB2_Driver_Common::__toString | ( | ) |
MDB2_Driver_Common::_affectedRows | ( | $connection, | |
$result = null |
|||
) |
Returns the number of rows affected.
resource | result handle |
resource | connection handle |
private
Reimplemented in MDB2_Driver_oci8, and MDB2_Driver_mysql.
Definition at line 2447 of file MDB2.php.
References MDB2_ERROR_UNSUPPORTED, and raiseError().
Referenced by exec(), replace(), and standaloneQuery().
& MDB2_Driver_Common::_doQuery | ( | $query, | |
$is_manip = false , |
|||
$connection = null , |
|||
$database_name = null |
|||
) |
Execute a query.
string | query |
bool | if the query is a manipulation query |
resource | connection handle |
string | database name |
protected
Reimplemented in MDB2_Driver_oci8, and MDB2_Driver_mysql.
Definition at line 2419 of file MDB2.php.
References $query, debug(), PEAR\isError(), MDB2_ERROR_UNSUPPORTED, and raiseError().
Referenced by exec(), query(), replace(), and standaloneQuery().
MDB2_Driver_Common::_fixResultArrayValues | ( | & | $row, |
$mode | |||
) |
Do all necessary conversions on result arrays to fix DBMS quirks.
array | the array to be fixed (passed by reference) |
array | bit-wise addition of the required portability modes |
protected
Definition at line 1755 of file MDB2.php.
References $row, MDB2_PORTABILITY_EMPTY_TO_NULL, MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES, and MDB2_PORTABILITY_RTRIM.
MDB2_Driver_Common::_modifyQuery | ( | $query, | |
$is_manip, | |||
$limit, | |||
$offset | |||
) |
Changes a query string for various DBMS specific reasons.
string | query to modify |
bool | if it is a DML query |
int | limit the number of rows |
int | start reading from given offset |
protected
Reimplemented in MDB2_Driver_mysql, and MDB2_Driver_oci8.
Definition at line 2400 of file MDB2.php.
References $query.
Referenced by exec(), query(), and standaloneQuery().
MDB2_Driver_Common::_skipDelimitedStrings | ( | $query, | |
$position, | |||
$p_position | |||
) |
Utility method, used by prepare() to avoid replacing placeholders within delimited strings.
Check if the placeholder is contained within a delimited string. If so, skip it and advance the position, otherwise return the current position, which is valid
string | $query | |
integer | $position | current string cursor position |
integer | $p_position | placeholder position |
protected
Definition at line 2963 of file MDB2.php.
References $identifier_quoting, $query, $sql_comments, $string_quoting, MDB2_ERROR_SYNTAX, and raiseError().
Referenced by MDB2_Driver_oci8\prepare(), MDB2_Driver_mysql\prepare(), and prepare().
& MDB2_Driver_Common::_wrapResult | ( | $result, | |
$types = array() , |
|||
$result_class = true , |
|||
$result_wrap_class = false , |
|||
$limit = null , |
|||
$offset = null |
|||
) |
wrap a result set into the correct class
resource | result handle |
mixed | array that contains the types of the columns in the result set |
mixed | string which specifies which result class to use |
mixed | string which specifies which class to wrap results in |
string | number of rows to select |
string | first row to select |
protected
Definition at line 2541 of file MDB2.php.
References $limit, $offset, MDB2\classExists(), PEAR\isError(), MDB2\isResultCommon(), loadModule(), MDB2_ERROR_NOT_FOUND, raiseError(), and supports().
Referenced by query(), MDB2_Driver_oci8\standaloneQuery(), and standaloneQuery().
MDB2_Driver_Common::beginNestedTransaction | ( | ) |
Start a nested transaction.
EXPERIMENTAL
WARNING: this function is experimental and may change signature at any time until labelled as non-experimental
public
Definition at line 2063 of file MDB2.php.
References $nested_transaction_counter, beginTransaction(), MDB2_OK, and supports().
MDB2_Driver_Common::beginTransaction | ( | $savepoint = null | ) |
Start a transaction or set a savepoint.
string | name of a savepoint to set |
public
Reimplemented in MDB2_Driver_mysql, and MDB2_Driver_oci8.
Definition at line 1950 of file MDB2.php.
References debug(), MDB2_ERROR_UNSUPPORTED, and raiseError().
Referenced by beginNestedTransaction(), and replace().
MDB2_Driver_Common::commit | ( | $savepoint = null | ) |
Commit the database changes done during a transaction that is in progress or release a savepoint.
This function may only be called when auto-committing is disabled, otherwise it will fail. Therefore, a new transaction is implicitly started after committing the pending changes.
string | name of a savepoint to release |
public
Reimplemented in MDB2_Driver_mysql, and MDB2_Driver_oci8.
Definition at line 1971 of file MDB2.php.
References debug(), MDB2_ERROR_UNSUPPORTED, and raiseError().
Referenced by completeNestedTransaction(), and replace().
MDB2_Driver_Common::compareDefinition | ( | $current, | |
$previous | |||
) |
Obtain an array of changes that may need to applied.
array | new definition |
array | old definition |
public
Definition at line 3057 of file MDB2.php.
References PEAR\isError(), and loadModule().
MDB2_Driver_Common::completeNestedTransaction | ( | $force_rollback = false | ) |
Finish a nested transaction by rolling back if an error occured or committing otherwise.
EXPERIMENTAL
WARNING: this function is experimental and may change signature at any time until labelled as non-experimental
bool | if the transaction should be rolled back regardless even if no error was set within the nested transaction |
public
Definition at line 2099 of file MDB2.php.
References $nested_transaction_counter, commit(), PEAR\isError(), MDB2_OK, rollback(), and supports().
MDB2_Driver_Common::connect | ( | ) |
Connect to the database.
Reimplemented in MDB2_Driver_oci8, and MDB2_Driver_mysql.
Definition at line 2199 of file MDB2.php.
References MDB2_ERROR_UNSUPPORTED, and raiseError().
Referenced by getConnection().
MDB2_Driver_Common::currID | ( | $seq_name | ) |
Returns the current id of a sequence.
string | name of the sequence |
public
Reimplemented in MDB2_Driver_mysql.
Definition at line 3177 of file MDB2.php.
References nextID().
MDB2_Driver_Common::debug | ( | $message, | |
$scope = '' , |
|||
$context = array() |
|||
) |
set a debug message
string | message that should be appended to the debug variable |
string | usually the method name that triggered the debug call: for example 'query', 'prepare', 'execute', 'parameters', 'beginTransaction', 'commit', 'rollback' |
array | contains context information about the debug() call common keys are: is_manip, time, result etc. |
public
Definition at line 1582 of file MDB2.php.
Referenced by MDB2_Driver_mysql\_doQuery(), MDB2_Driver_oci8\_doQuery(), _doQuery(), MDB2_Driver_oci8\beginTransaction(), MDB2_Driver_mysql\beginTransaction(), beginTransaction(), MDB2_Driver_oci8\commit(), MDB2_Driver_mysql\commit(), commit(), MDB2_Driver_oci8\prepare(), MDB2_Driver_mysql\prepare(), prepare(), MDB2_Driver_oci8\rollback(), MDB2_Driver_mysql\rollback(), rollback(), MDB2_Driver_oci8\setTransactionIsolation(), MDB2_Driver_mysql\setTransactionIsolation(), and setTransactionIsolation().
MDB2_Driver_Common::disconnect | ( | $force = true | ) |
Log out and disconnect from the database.
bool | if the disconnect should be forced even if the connection is opened persistently |
public
Reimplemented in MDB2_Driver_mysql, and MDB2_Driver_oci8.
Definition at line 2236 of file MDB2.php.
References MDB2_OK.
Referenced by __destruct(), setDatabase(), and setDSN().
MDB2_Driver_Common::errorInfo | ( | $error = null | ) |
This method is used to collect information about an error.
mixed | error code or resource |
public
Reimplemented in MDB2_Driver_mysql, and MDB2_Driver_oci8.
Definition at line 1376 of file MDB2.php.
References $error.
Referenced by raiseError().
MDB2_Driver_Common::escape | ( | $text, | |
$escape_wildcards = false |
|||
) |
Quotes a string so it can be safely used in a query.
It will quote the text so it can safely be used within a query.
string | the input string to quote |
bool | escape wildcards |
public
Reimplemented in MDB2_Driver_mysql.
Definition at line 1625 of file MDB2.php.
References escapePattern().
MDB2_Driver_Common::escapePattern | ( | $text | ) |
Quotes pattern (% and _) characters in a string)
EXPERIMENTAL
WARNING: this function is experimental and may change signature at any time until labelled as non-experimental
string | the input string to quote |
public
Definition at line 1652 of file MDB2.php.
Referenced by MDB2_Driver_mysql\escape(), and escape().
& MDB2_Driver_Common::exec | ( | $query | ) |
Execute a manipulation query to the database and return the number of affected rows.
string | the SQL query |
public
Definition at line 2465 of file MDB2.php.
References $connection, $limit, $offset, $query, _affectedRows(), _doQuery(), _modifyQuery(), getConnection(), and PEAR\isError().
MDB2_Driver_Common::failNestedTransaction | ( | $error = null , |
|
$immediately = false |
|||
) |
Force setting nested transaction to failed.
EXPERIMENTAL
WARNING: this function is experimental and may change signature at any time until labelled as non-experimental
mixed | value to return in getNestededTransactionError() |
bool | if the transaction should be rolled back immediately |
public
Definition at line 2156 of file MDB2.php.
References $error, MDB2_OK, and rollback().
MDB2_Driver_Common::free | ( | ) |
MDB2_Driver_Common::getAsKeyword | ( | ) |
Gets the string to alias column.
Definition at line 1717 of file MDB2.php.
References $as_keyword.
MDB2_Driver_Common::getConnection | ( | ) |
Returns a native connection.
public
Definition at line 1733 of file MDB2.php.
References $connection, connect(), and PEAR\isError().
Referenced by MDB2_Driver_mysql\_affectedRows(), MDB2_Driver_oci8\_affectedRows(), MDB2_Driver_mysql\_doQuery(), MDB2_Driver_oci8\_doQuery(), MDB2_Driver_oci8\commit(), MDB2_Driver_mysql\escape(), exec(), MDB2_Driver_mysql\getServerVersion(), MDB2_Driver_oci8\getServerVersion(), MDB2_Driver_oci8\prepare(), MDB2_Driver_mysql\prepare(), query(), MDB2_Driver_mysql\replace(), replace(), MDB2_Driver_oci8\rollback(), MDB2_Driver_mysql\setCharset(), and standaloneQuery().
MDB2_Driver_Common::getDatabase | ( | ) |
Get the current database.
public
Definition at line 2278 of file MDB2.php.
References $database_name.
MDB2_Driver_Common::getDebugOutput | ( | ) |
output debug info
public
Definition at line 1606 of file MDB2.php.
References $debug_output.
MDB2_Driver_Common::getDeclaration | ( | $type, | |
$name, | |||
$field | |||
) |
Obtain DBMS specific SQL code portion needed to declare of the given type.
string | type to which the value should be converted to |
string | name the field to be declared. |
string | definition of the field |
public
Definition at line 3035 of file MDB2.php.
References $name, $type, PEAR\isError(), and loadModule().
MDB2_Driver_Common::getDSN | ( | $type = 'string' , |
|
$hidepw = false |
|||
) |
return the DSN as a string
string | format to return ("array", "string") |
string | string to hide the password with |
public
Definition at line 2320 of file MDB2.php.
References $database_name, $dsn, $GLOBALS, $phptype, and $type.
MDB2_Driver_Common::getIndexName | ( | $idx | ) |
MDB2_Driver_Common::getNestedTransactionError | ( | ) |
The first error that occured since the transaction start.
EXPERIMENTAL
WARNING: this function is experimental and may change signature at any time until labelled as non-experimental
public
Definition at line 2186 of file MDB2.php.
References $has_transaction_error.
MDB2_Driver_Common::getOption | ( | $option | ) |
Returns the value of an option.
string | option name |
public
Definition at line 1556 of file MDB2.php.
References MDB2_ERROR_UNSUPPORTED, and raiseError().
Referenced by MDB2_Driver_oci8\_doQuery(), and loadModule().
MDB2_Driver_Common::getSequenceName | ( | $sqn | ) |
adds sequence name formatting to a sequence name
string | name of the sequence |
public
Definition at line 3102 of file MDB2.php.
Referenced by MDB2_Driver_oci8\currId(), MDB2_Driver_mysql\currID(), MDB2_Driver_oci8\lastInsertID(), MDB2_Driver_oci8\nextID(), and MDB2_Driver_mysql\nextID().
MDB2_Driver_Common::getServerVersion | ( | $native = false | ) |
return version information about the server
bool | determines if the raw version string should be returned |
public
Reimplemented in MDB2_Driver_oci8, and MDB2_Driver_mysql.
Definition at line 2612 of file MDB2.php.
References MDB2_ERROR_UNSUPPORTED, and raiseError().
MDB2_Driver_Common::getWarnings | ( | ) |
Get all warnings in reverse order.
This means that the last warning is the first element in the array
public
Definition at line 1477 of file MDB2.php.
MDB2_Driver_Common::inTransaction | ( | $ignore_nested = false | ) |
If a transaction is currently open.
bool | if the nested transaction count should be ignored |
public
Definition at line 2013 of file MDB2.php.
References $in_transaction, and $nested_transaction_counter.
MDB2_Driver_Common::lastInsertID | ( | $table = null , |
|
$field = null |
|||
) |
Returns the autoincrement ID if supported or $id or fetches the current ID in a sequence called: $table.
(empty($field) ? '' : '_'.$field)
string | name of the table into which a new row was inserted |
string | name of the field into which a new row was inserted |
public
Reimplemented in MDB2_Driver_mysql, and MDB2_Driver_oci8.
Definition at line 3159 of file MDB2.php.
References MDB2_ERROR_UNSUPPORTED, and raiseError().
& MDB2_Driver_Common::loadModule | ( | $module, | |
$property = null , |
|||
$phptype_specific = null |
|||
) |
loads a module
string | name of the module that should be loaded (only used for error messages) |
string | name of the property into which the class will be loaded |
bool | if the class to load for the module is specific to the phptype |
public
Definition at line 1840 of file MDB2.php.
References $file_name, $phptype, MDB2\classExists(), MDB2\fileExists(), getOption(), PEAR\isError(), MDB2\loadClass(), MDB2_ERROR_LOADMODULE, and raiseError().
Referenced by __call(), _wrapResult(), compareDefinition(), getDeclaration(), MDB2_Driver_oci8\nextID(), MDB2_Driver_mysql\nextID(), quote(), and subSelect().
MDB2_Driver_Common::MDB2_Driver_Common | ( | ) |
PHP 4 Constructor.
Definition at line 1310 of file MDB2.php.
References __construct().
MDB2_Driver_Common::nextID | ( | $seq_name, | |
$ondemand = true |
|||
) |
Returns the next free id of a sequence.
string | name of the sequence |
bool | when true missing sequences are automatic created |
public
Reimplemented in MDB2_Driver_mysql, and MDB2_Driver_oci8.
Definition at line 3139 of file MDB2.php.
References MDB2_ERROR_UNSUPPORTED, and raiseError().
Referenced by currID().
& MDB2_Driver_Common::prepare | ( | $query, | |
$types = null , |
|||
$result_types = null , |
|||
$lobs = array() |
|||
) |
Prepares a query for multiple execution with execute().
With some database backends, this is emulated. prepare() requires a generic query as string like 'INSERT INTO numbers VALUES(?,?)' or 'INSERT INTO numbers VALUES(:foo,:bar)'. The ? and :[a-zA-Z] and are placeholders which can be set using bindParam() and the query can be send off using the execute() method.
string | the query to prepare |
mixed | array that contains the types of the placeholders |
mixed | array that contains the types of the columns in the result set or MDB2_PREPARE_RESULT, if set to MDB2_PREPARE_MANIP the query is handled as a manipulation query |
mixed | key (field) value (parameter) pair for all lob placeholders |
public
Reimplemented in MDB2_Driver_mysql, and MDB2_Driver_oci8.
Definition at line 2855 of file MDB2.php.
References $identifier_quoting, $limit, $offset, $query, $sql_comments, $string_quoting, _skipDelimitedStrings(), debug(), PEAR\isError(), MDB2_ERROR_SYNTAX, MDB2_PREPARE_MANIP, and raiseError().
& MDB2_Driver_Common::query | ( | $query, | |
$types = null , |
|||
$result_class = true , |
|||
$result_wrap_class = false |
|||
) |
Send a query to the database and return any results.
string | the SQL query |
mixed | array that contains the types of the columns in the result set |
mixed | string which specifies which result class to use |
mixed | string which specifies which class to wrap results in |
public
Definition at line 2502 of file MDB2.php.
References $connection, $limit, $offset, $query, _doQuery(), _modifyQuery(), _wrapResult(), getConnection(), and PEAR\isError().
Referenced by queryAll(), queryCol(), queryOne(), and queryRow().
MDB2_Driver_Common::queryAll | ( | $query, | |
$types = null , |
|||
$fetchmode = MDB2_FETCHMODE_DEFAULT , |
|||
$rekey = false , |
|||
$force_array = false , |
|||
$group = false |
|||
) |
Execute the specified query, fetch all the rows of the result set into a two dimensional array and then frees the result set.
string | the SELECT query statement to be executed. |
array | optional array argument that specifies a list of expected datatypes of the result set columns, so that the eventual conversions may be performed. The default list of datatypes is empty, meaning that no conversion is performed. |
int | how the array data should be indexed |
bool | if set to true, the $all will have the first column as its first dimension |
bool | used only when the query returns exactly two columns. If true, the values of the returned array will be one-element arrays instead of scalars. |
bool | if true, the values of the returned array is wrapped in another array. If the same key value (in the first column) repeats itself, the values will be appended to this array instead of overwriting the existing values. |
public
Definition at line 3303 of file MDB2.php.
References $fetchmode, $query, MDB2\isResultCommon(), and query().
MDB2_Driver_Common::queryCol | ( | $query, | |
$type = null , |
|||
$colnum = 0 |
|||
) |
Execute the specified query, fetch the value from the first column of each row of the result set into an array and then frees the result set.
string | the SELECT query statement to be executed. |
string | optional argument that specifies the expected datatype of the result set field, so that an eventual conversion may be performed. The default datatype is text, meaning that no conversion is performed |
int | the row number to fetch |
public
Definition at line 3264 of file MDB2.php.
References $query, $type, MDB2\isResultCommon(), and query().
Referenced by subSelect().
MDB2_Driver_Common::queryOne | ( | $query, | |
$type = null , |
|||
$colnum = 0 |
|||
) |
Execute the specified query, fetch the value from the first column of the first row of the result set and then frees the result set.
string | the SELECT query statement to be executed. |
string | optional argument that specifies the expected datatype of the result set field, so that an eventual conversion may be performed. The default datatype is text, meaning that no conversion is performed |
int | the column number to fetch |
public
Definition at line 3203 of file MDB2.php.
References $query, $type, MDB2\isResultCommon(), and query().
Referenced by MDB2_Driver_oci8\currId(), MDB2_Driver_mysql\currID(), MDB2_Driver_oci8\lastInsertID(), MDB2_Driver_mysql\lastInsertID(), and MDB2_Driver_oci8\nextID().
MDB2_Driver_Common::queryRow | ( | $query, | |
$types = null , |
|||
$fetchmode = MDB2_FETCHMODE_DEFAULT |
|||
) |
Execute the specified query, fetch the values from the first row of the result set into an array and then frees the result set.
string | the SELECT query statement to be executed. |
array | optional array argument that specifies a list of expected datatypes of the result set columns, so that the eventual conversions may be performed. The default list of datatypes is empty, meaning that no conversion is performed. |
int | how the array data should be indexed |
public
Definition at line 3234 of file MDB2.php.
References $fetchmode, $query, $row, MDB2\isResultCommon(), and query().
MDB2_Driver_Common::quote | ( | $value, | |
$type = null , |
|||
$quote = true , |
|||
$escape_wildcards = false |
|||
) |
Convert a text value into a DBMS specific format that is suitable to compose query statements.
string | text string value that is intended to be converted. |
string | type to which the value should be converted to |
bool | quote |
bool | escape wildcards |
public
Definition at line 3009 of file MDB2.php.
References $type, PEAR\isError(), and loadModule().
Referenced by MDB2_Driver_oci8\prepare(), MDB2_Driver_mysql\replace(), and replace().
MDB2_Driver_Common::quoteIdentifier | ( | $str, | |
$check_option = false |
|||
) |
Quote a string so it can be safely used as a table or column name.
Delimiting style depends on which database driver is being used.
NOTE: just because you CAN use delimited identifiers doesn't mean you SHOULD use them. In general, they end up causing way more problems than they solve.
Portability is broken by using the following characters inside delimited identifiers:
`
) – due to MySQL"
) – due to Oracle[
or ]
) – due to AccessDelimited identifiers are known to generally work correctly under the following drivers:
InterBase doesn't seem to be able to use delimited identifiers via PHP 4. They work fine under PHP 5.
string | identifier name to be quoted |
bool | check the 'quote_identifier' option |
public
Definition at line 1700 of file MDB2.php.
Referenced by MDB2_Driver_mysql\currID(), MDB2_Driver_oci8\lastInsertID(), MDB2_Driver_oci8\nextID(), and MDB2_Driver_mysql\nextID().
& MDB2_Driver_Common::raiseError | ( | $code = null , |
|
$mode = null , |
|||
$options = null , |
|||
$userinfo = null , |
|||
$method = null |
|||
) |
This method is used to communicate an error and invoke error callbacks etc.
Basically a wrapper for PEAR::raiseError without the message string.
mixed | integer error code, or a PEAR error object (all other parameters are ignored if this parameter is an object |
int | error mode, see PEAR_Error docs |
mixed | If error mode is PEAR_ERROR_TRIGGER, this is the error level (E_USER_NOTICE etc). If error mode is PEAR_ERROR_CALLBACK, this is the callback function, either as a function name, or as an array of an object and method name. For other error modes this parameter is ignored. |
string | Extra debug information. Defaults to the last query and native error code. |
string | name of the method that triggered the error |
public
Definition at line 1407 of file MDB2.php.
References PEAR\$_default_error_mode, PEAR\$_default_error_options, $has_transaction_error, $options, errorInfo(), PEAR\isError(), MDB2_ERROR_NOT_FOUND, and PEAR_ERROR_RETURN.
Referenced by _affectedRows(), MDB2_Driver_oci8\_doConnect(), MDB2_Driver_mysql\_doQuery(), MDB2_Driver_oci8\_doQuery(), _doQuery(), _skipDelimitedStrings(), _wrapResult(), MDB2_Driver_oci8\beginTransaction(), MDB2_Driver_mysql\beginTransaction(), beginTransaction(), MDB2_Driver_oci8\commit(), MDB2_Driver_mysql\commit(), commit(), MDB2_Driver_mysql\connect(), connect(), getOption(), MDB2_Driver_mysql\getServerVersion(), MDB2_Driver_oci8\getServerVersion(), getServerVersion(), lastInsertID(), loadModule(), MDB2_Driver_mysql\nextID(), nextID(), MDB2_Driver_oci8\prepare(), MDB2_Driver_mysql\prepare(), prepare(), MDB2_Driver_mysql\replace(), replace(), MDB2_Driver_oci8\rollback(), MDB2_Driver_mysql\rollback(), rollback(), setCharset(), setFetchMode(), setLimit(), setOption(), MDB2_Driver_oci8\setTransactionIsolation(), MDB2_Driver_mysql\setTransactionIsolation(), setTransactionIsolation(), subSelect(), and supports().
MDB2_Driver_Common::replace | ( | $table, | |
$fields | |||
) |
Execute a SQL REPLACE query.
A REPLACE query is identical to a INSERT query, except that if there is already a row in the table with the same key field values, the REPLACE query just updates its values instead of inserting a new row.
The REPLACE type of query does not make part of the SQL standards. Since practically only MySQL and SQLite implement it natively, this type of query isemulated through this method for other DBMS using standard types of queries inside a transaction to assure the atomicity of the operation.
string | name of the table on which the REPLACE query will be executed. |
array | associative array that describes the fields and the values that will be inserted or updated in the specified table. The indexes of the array are the names of all the fields of the table. The values of the array are also associative arrays that describe the values and other properties of the table fields. |
Here follows a list of field properties that need to be specified:
value Value to be assigned to the specified field. This value may be of specified in database independent type format as this function can perform the necessary datatype conversions.
Default: this property is required unless the Null property is set to 1.
type Name of the type of the field. Currently, all types MDB2 are supported except for clob and blob.
Default: no type conversion
null bool property that indicates that the value for this field should be set to null.
The default value for fields missing in INSERT queries may be specified the definition of a table. Often, the default value is already null, but since the REPLACE may be emulated using an UPDATE query, make sure that all fields of the table are listed in this function argument array.
Default: 0
key bool property that indicates that this field should be handled as a primary key or at least as part of the compound unique index of the table that will determine the row that will updated if it exists or inserted a new row otherwise.
This function will fail if no key field is specified or if the value of a key field is set to null because fields that are part of unique index they may not be null.
Default: 0
public
Reimplemented in MDB2_Driver_mysql.
Definition at line 2760 of file MDB2.php.
References $connection, $in_transaction, $name, $query, $type, _affectedRows(), _doQuery(), beginTransaction(), commit(), getConnection(), PEAR\isError(), MDB2_ERROR_CANNOT_REPLACE, MDB2_ERROR_UNSUPPORTED, quote(), raiseError(), rollback(), and supports().
MDB2_Driver_Common::resetWarnings | ( | ) |
MDB2_Driver_Common::rollback | ( | $savepoint = null | ) |
Cancel any database changes done during a transaction or since a specific savepoint that is in progress.
This function may only be called when auto-committing is disabled, otherwise it will fail. Therefore, a new transaction is implicitly started after canceling the pending changes.
string | name of a savepoint to rollback to |
public
Reimplemented in MDB2_Driver_mysql, and MDB2_Driver_oci8.
Definition at line 1992 of file MDB2.php.
References debug(), MDB2_ERROR_UNSUPPORTED, and raiseError().
Referenced by completeNestedTransaction(), failNestedTransaction(), and replace().
MDB2_Driver_Common::setCharset | ( | $charset, | |
$connection = null |
|||
) |
Set the charset on the current connection.
string | charset |
resource | connection handle |
Reimplemented in MDB2_Driver_mysql.
Definition at line 2216 of file MDB2.php.
References MDB2_ERROR_UNSUPPORTED, and raiseError().
Referenced by MDB2_Driver_oci8\_doConnect().
MDB2_Driver_Common::setDatabase | ( | $name | ) |
Select a different database.
string | name of the database that should be selected |
public
Definition at line 2260 of file MDB2.php.
References $name, and disconnect().
MDB2_Driver_Common::setDSN | ( | $dsn | ) |
set the DSN
mixed | DSN string or array |
public
Definition at line 2295 of file MDB2.php.
References $dsn, $GLOBALS, disconnect(), and MDB2\parseDSN().
MDB2_Driver_Common::setFetchMode | ( | $fetchmode, | |
$object_class = 'stdClass' |
|||
) |
Sets which fetch mode should be used by default on queries on this connection.
int | MDB2_FETCHMODE_ORDERED, MDB2_FETCHMODE_ASSOC or MDB2_FETCHMODE_OBJECT |
string | the class name of the object to be returned by the fetch methods when the MDB2_FETCHMODE_OBJECT mode is selected. If no class is specified by default a cast to object from the assoc array row will be done. There is also the possibility to use and extend the 'MDB2_row' class. |
public
Definition at line 1504 of file MDB2.php.
References $fetchmode, MDB2_ERROR_UNSUPPORTED, MDB2_FETCHMODE_ASSOC, MDB2_FETCHMODE_OBJECT, MDB2_FETCHMODE_ORDERED, MDB2_OK, and raiseError().
MDB2_Driver_Common::setLimit | ( | $limit, | |
$offset = null |
|||
) |
set the range of the next query
string | number of rows to select |
string | first row to select |
public
Definition at line 2631 of file MDB2.php.
References $limit, $offset, MDB2_ERROR_SYNTAX, MDB2_ERROR_UNSUPPORTED, MDB2_OK, raiseError(), and supports().
MDB2_Driver_Common::setOption | ( | $option, | |
$value | |||
) |
set the option for the db class
string | option name |
mixed | value for the option |
public
Definition at line 1534 of file MDB2.php.
References MDB2_ERROR_UNSUPPORTED, MDB2_OK, and raiseError().
MDB2_Driver_Common::setTransactionIsolation | ( | $isolation, | |
$options = array() |
|||
) |
Set the transacton isolation level.
string | standard isolation level READ UNCOMMITTED (allows dirty reads) READ COMMITTED (prevents dirty reads) REPEATABLE READ (prevents nonrepeatable reads) SERIALIZABLE (prevents phantom reads) |
array | some transaction options: 'wait' => 'WAIT' | 'NO WAIT' 'rw' => 'READ WRITE' | 'READ ONLY' |
public
Definition at line 2040 of file MDB2.php.
References debug(), MDB2_ERROR_UNSUPPORTED, and raiseError().
& MDB2_Driver_Common::standaloneQuery | ( | $query, | |
$types = null , |
|||
$is_manip = false |
|||
) |
execute a query as database administrator
string | the SQL query |
mixed | array that contains the types of the columns in the result set |
bool | if the query is a manipulation query |
public
Reimplemented in MDB2_Driver_oci8.
Definition at line 2360 of file MDB2.php.
References $connection, $limit, $offset, $query, _affectedRows(), _doQuery(), _modifyQuery(), _wrapResult(), getConnection(), and PEAR\isError().
MDB2_Driver_Common::subSelect | ( | $query, | |
$type = false |
|||
) |
simple subselect emulation: leaves the query untouched for all RDBMS that support subselects
string | the SQL query for the subselect that may only return a column |
string | determines type of the field |
public
Definition at line 2669 of file MDB2.php.
References $query, $type, PEAR\isError(), loadModule(), MDB2_ERROR_UNSUPPORTED, queryCol(), raiseError(), and supports().
MDB2_Driver_Common::supports | ( | $feature | ) |
Tell whether a DB implementation or its backend extension supports a given feature.
string | name of the feature (see the MDB2 class doc) |
public
Definition at line 3081 of file MDB2.php.
References MDB2_ERROR_UNSUPPORTED, and raiseError().
Referenced by _wrapResult(), beginNestedTransaction(), MDB2_Driver_mysql\beginTransaction(), MDB2_Driver_mysql\commit(), completeNestedTransaction(), replace(), MDB2_Driver_mysql\rollback(), setLimit(), MDB2_Driver_mysql\setTransactionIsolation(), and subSelect().
MDB2_Driver_Common::$as_keyword = ' AS ' |
Definition at line 1197 of file MDB2.php.
Referenced by getAsKeyword().
MDB2_Driver_Common::$connected_database_name = '' |
Definition at line 1040 of file MDB2.php.
Referenced by MDB2_Driver_oci8\disconnect(), and MDB2_Driver_mysql\disconnect().
MDB2_Driver_Common::$connected_dsn = array() |
Definition at line 1012 of file MDB2.php.
Referenced by MDB2_Driver_oci8\disconnect(), and MDB2_Driver_mysql\disconnect().
MDB2_Driver_Common::$connected_server_info = '' |
Definition at line 1047 of file MDB2.php.
Referenced by MDB2_Driver_mysql\getServerVersion(), and MDB2_Driver_oci8\getServerVersion().
MDB2_Driver_Common::$connection = 0 |
Definition at line 1019 of file MDB2.php.
Referenced by MDB2_Driver_mysql\_affectedRows(), MDB2_Driver_oci8\_affectedRows(), MDB2_Driver_oci8\_doConnect(), MDB2_Driver_mysql\_doQuery(), MDB2_Driver_oci8\_doQuery(), MDB2_Driver_oci8\commit(), MDB2_Driver_mysql\connect(), MDB2_Driver_oci8\connect(), MDB2_Driver_mysql\escape(), exec(), getConnection(), MDB2_Driver_mysql\getServerVersion(), MDB2_Driver_oci8\getServerVersion(), MDB2_Driver_oci8\prepare(), MDB2_Driver_mysql\prepare(), query(), MDB2_Driver_mysql\replace(), replace(), MDB2_Driver_oci8\rollback(), MDB2_Driver_mysql\setCharset(), MDB2_Driver_oci8\standaloneExec(), MDB2_Driver_oci8\standaloneQuery(), and standaloneQuery().
MDB2_Driver_Common::$database_name = '' |
Definition at line 1033 of file MDB2.php.
Referenced by MDB2_Driver_oci8\_doConnect(), MDB2_Driver_mysql\_doQuery(), MDB2_Driver_mysql\connect(), MDB2_Driver_oci8\connect(), MDB2_Driver_oci8\disconnect(), MDB2_Driver_mysql\disconnect(), getDatabase(), and getDSN().
MDB2_Driver_Common::$db_index = 0 |
Definition at line 998 of file MDB2.php.
Referenced by __construct().
MDB2_Driver_Common::$debug_output = '' |
Definition at line 1211 of file MDB2.php.
Referenced by getDebugOutput().
MDB2_Driver_Common::$dsn = array() |
Definition at line 1005 of file MDB2.php.
Referenced by MDB2_Driver_mysql\connect(), MDB2_Driver_oci8\connect(), MDB2_Driver_oci8\disconnect(), MDB2_Driver_mysql\disconnect(), getDSN(), and setDSN().
MDB2_Driver_Common::$fetchmode = MDB2_FETCHMODE_ORDERED |
Definition at line 1274 of file MDB2.php.
Referenced by queryAll(), queryRow(), and setFetchMode().
MDB2_Driver_Common::$has_transaction_error = false |
Definition at line 1232 of file MDB2.php.
Referenced by getNestedTransactionError(), and raiseError().
MDB2_Driver_Common::$identifier_quoting = array('start' => '"', 'end' => '"', 'escape' => '"') |
Definition at line 1173 of file MDB2.php.
Referenced by _skipDelimitedStrings(), and prepare().
MDB2_Driver_Common::$in_transaction = false |
Definition at line 1218 of file MDB2.php.
Referenced by inTransaction(), and replace().
MDB2_Driver_Common::$limit = 0 |
Definition at line 1246 of file MDB2.php.
Referenced by MDB2_Driver_oci8\_modifyQuery(), MDB2_Driver_mysql\_modifyQuery(), _wrapResult(), exec(), MDB2_Driver_oci8\prepare(), MDB2_Driver_mysql\prepare(), prepare(), query(), setLimit(), MDB2_Driver_oci8\standaloneExec(), MDB2_Driver_oci8\standaloneQuery(), and standaloneQuery().
MDB2_Driver_Common::$nested_transaction_counter = null |
Definition at line 1225 of file MDB2.php.
Referenced by beginNestedTransaction(), completeNestedTransaction(), and inTransaction().
MDB2_Driver_Common::$offset = 0 |
Definition at line 1239 of file MDB2.php.
Referenced by MDB2_Driver_oci8\_modifyQuery(), _wrapResult(), exec(), MDB2_Driver_oci8\prepare(), MDB2_Driver_mysql\prepare(), prepare(), query(), setLimit(), MDB2_Driver_oci8\standaloneExec(), MDB2_Driver_oci8\standaloneQuery(), and standaloneQuery().
MDB2_Driver_Common::$opened_persistent |
Definition at line 1026 of file MDB2.php.
Referenced by MDB2_Driver_oci8\disconnect(), and MDB2_Driver_mysql\disconnect().
MDB2_Driver_Common::$options |
Definition at line 1122 of file MDB2.php.
Referenced by raiseError().
MDB2_Driver_Common::$phptype |
Definition at line 1253 of file MDB2.php.
Referenced by MDB2_Driver_mysql\connect(), MDB2_Driver_oci8\connect(), getDSN(), and loadModule().
MDB2_Driver_Common::$sql_comments |
Definition at line 1180 of file MDB2.php.
Referenced by _skipDelimitedStrings(), and prepare().
MDB2_Driver_Common::$string_quoting = array('start' => "'", 'end' => "'", 'escape' => false, 'escape_pattern' => false) |
Definition at line 1166 of file MDB2.php.
Referenced by _skipDelimitedStrings(), and prepare().
MDB2_Driver_Common::$supported |