ILIAS
Release_4_0_x_branch Revision 61816
|
Public Member Functions | |
__construct () | |
Constructor. | |
errorInfo ($error=null) | |
This method is used to collect information about an error. | |
escape ($text, $escape_wildcards=false) | |
Quotes a string so it can be safely used in a query. | |
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. | |
setTransactionIsolation ($isolation) | |
Set the transacton isolation level. | |
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. | |
& | _doQuery ($query, $is_manip=false, $connection=null, $database_name=null) |
Execute a query. | |
_affectedRows ($connection, $result=null) | |
Returns the number of rows affected. | |
_modifyQuery ($query, $is_manip, $limit, $offset) | |
Changes a query string for various DBMS specific reasons. | |
getServerVersion ($native=false) | |
return version information about the server | |
_getServerCapabilities () | |
Fetch some information about the server capabilities (transactions, subselects, prepared statements, etc). | |
_skipUserDefinedVariable ($query, $position) | |
Utility method, used by prepare() to avoid misinterpreting MySQL user defined variables (SELECT :=5) for placeholders. | |
& | prepare ($query, $types=null, $result_types=null, $lobs=array()) |
Prepares a query for multiple execution with execute(). | |
replace ($table, $fields) | |
Execute a SQL REPLACE query. | |
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. | |
Public Member Functions inherited from MDB2_Driver_Common | |
MDB2_Driver_Common () | |
PHP 4 Constructor. | |
__destruct () | |
Destructor. | |
free () | |
Free the internal references so that the instance can be destroyed. | |
__toString () | |
String conversation. | |
& | 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 | |
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. | |
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. | |
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 | |
& | 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 | |
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 | |
_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 | |
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. |
MDB2_Driver_mysql::__construct | ( | ) |
Constructor.
Reimplemented from MDB2_Driver_Common.
Definition at line 78 of file mysql.php.
MDB2_Driver_mysql::_affectedRows | ( | $connection, | |
$result = null |
|||
) |
Returns the number of rows affected.
resource | $result | |
resource | $connection |
Reimplemented from MDB2_Driver_Common.
Definition at line 628 of file mysql.php.
References MDB2_Driver_Common\$connection, MDB2_Driver_Common\getConnection(), and PEAR\isError().
Referenced by replace().
& MDB2_Driver_mysql::_doQuery | ( | $query, | |
$is_manip = false , |
|||
$connection = null , |
|||
$database_name = null |
|||
) |
Execute a query.
string | $query | query |
boolean | $is_manip | if the query is a manipulation query |
resource | $connection | |
string | $database_name |
Reimplemented from MDB2_Driver_Common.
Definition at line 568 of file mysql.php.
References MDB2_Driver_Common\$connection, MDB2_Driver_Common\$database_name, $err, $query, $result, MDB2_Driver_Common\debug(), MDB2_Driver_Common\getConnection(), PEAR\isError(), and MDB2_Driver_Common\raiseError().
Referenced by beginTransaction(), commit(), nextID(), prepare(), replace(), rollback(), setCharset(), and setTransactionIsolation().
MDB2_Driver_mysql::_getServerCapabilities | ( | ) |
Fetch some information about the server capabilities (transactions, subselects, prepared statements, etc).
private
Definition at line 748 of file mysql.php.
References getServerVersion().
Referenced by beginTransaction(), and connect().
MDB2_Driver_mysql::_modifyQuery | ( | $query, | |
$is_manip, | |||
$limit, | |||
$offset | |||
) |
Changes a query string for various DBMS specific reasons.
string | $query | query to modify |
boolean | $is_manip | if it is a DML query |
integer | $limit | limit the number of rows |
integer | $offset | start reading from given offset |
Reimplemented from MDB2_Driver_Common.
Definition at line 652 of file mysql.php.
References MDB2_Driver_Common\$limit, $query, elseif(), and MDB2_PORTABILITY_DELETE_COUNT.
Referenced by prepare().
MDB2_Driver_mysql::_skipUserDefinedVariable | ( | $query, | |
$position | |||
) |
Utility method, used by prepare() to avoid misinterpreting MySQL user defined variables (SELECT :=5) for placeholders.
Check if the placeholder is a false positive, i.e. if it is an user defined variable instead. If so, skip it and advance the position, otherwise return the current position, which is valid
string | $query | |
integer | $position | current string cursor position |
Definition at line 799 of file mysql.php.
References $query.
Referenced by prepare().
MDB2_Driver_mysql::beginTransaction | ( | $savepoint = null | ) |
Start a transaction or set a savepoint.
string | name of a savepoint to set |
public
Reimplemented from MDB2_Driver_Common.
Definition at line 214 of file mysql.php.
References $query, $result, _doQuery(), _getServerCapabilities(), MDB2_Driver_Common\debug(), elseif(), PEAR\isError(), MDB2_ERROR_INVALID, MDB2_ERROR_UNSUPPORTED, MDB2_OK, MDB2_Driver_Common\raiseError(), and MDB2_Driver_Common\supports().
MDB2_Driver_mysql::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 from MDB2_Driver_Common.
Definition at line 259 of file mysql.php.
References $query, $result, _doQuery(), MDB2_Driver_Common\debug(), getServerVersion(), PEAR\isError(), MDB2_ERROR_INVALID, MDB2_ERROR_UNSUPPORTED, MDB2_OK, MDB2_Driver_Common\raiseError(), and MDB2_Driver_Common\supports().
MDB2_Driver_mysql::connect | ( | ) |
Connect to the database.
Reimplemented from MDB2_Driver_Common.
Definition at line 391 of file mysql.php.
References MDB2_Driver_Common\$connection, MDB2_Driver_Common\$database_name, MDB2_Driver_Common\$dsn, $err, $params, MDB2_Driver_Common\$phptype, $result, _getServerCapabilities(), disconnect(), PEAR\isError(), PEAR\loadExtension(), MDB2_ERROR_CONNECT_FAILED, MDB2_ERROR_NOT_FOUND, MDB2_OK, MDB2_Driver_Common\raiseError(), and setCharset().
MDB2_Driver_mysql::currID | ( | $seq_name | ) |
Returns the current id of a sequence.
string | $seq_name | name of the sequence |
Reimplemented from MDB2_Driver_Common.
Definition at line 1117 of file mysql.php.
References $query, MDB2_Driver_Common\getSequenceName(), MDB2_Driver_Common\queryOne(), and MDB2_Driver_Common\quoteIdentifier().
MDB2_Driver_mysql::disconnect | ( | $force = true | ) |
Log out and disconnect from the database.
boolean | $force | if the disconnect should be forced even if the connection is opened persistently |
Reimplemented from MDB2_Driver_Common.
Definition at line 533 of file mysql.php.
References MDB2_Driver_Common\$connected_database_name, MDB2_Driver_Common\$connected_dsn, MDB2_Driver_Common\$database_name, MDB2_Driver_Common\$dsn, MDB2_Driver_Common\$opened_persistent, and rollback().
Referenced by connect().
MDB2_Driver_mysql::errorInfo | ( | $error = null | ) |
This method is used to collect information about an error.
integer | $error |
Reimplemented from MDB2_Driver_Common.
Definition at line 118 of file mysql.php.
References $error, MDB2_ERROR_ACCESS_VIOLATION, MDB2_ERROR_ALREADY_EXISTS, MDB2_ERROR_CANNOT_CREATE, MDB2_ERROR_CANNOT_DROP, MDB2_ERROR_CONSTRAINT, MDB2_ERROR_CONSTRAINT_NOT_NULL, MDB2_ERROR_DIVZERO, MDB2_ERROR_NODBSELECTED, MDB2_ERROR_NOSUCHDB, MDB2_ERROR_NOSUCHFIELD, MDB2_ERROR_NOSUCHTABLE, MDB2_ERROR_NOT_FOUND, MDB2_ERROR_NOT_LOCKED, MDB2_ERROR_SYNTAX, MDB2_ERROR_VALUE_COUNT_ON_ROW, and MDB2_PORTABILITY_ERRORS.
MDB2_Driver_mysql::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 from MDB2_Driver_Common.
Definition at line 190 of file mysql.php.
References MDB2_Driver_Common\$connection, MDB2_Driver_Common\escapePattern(), MDB2_Driver_Common\getConnection(), and PEAR\isError().
MDB2_Driver_mysql::getServerVersion | ( | $native = false | ) |
return version information about the server
bool | $native | determines if the raw version string should be returned |
Reimplemented from MDB2_Driver_Common.
Definition at line 703 of file mysql.php.
References MDB2_Driver_Common\$connected_server_info, MDB2_Driver_Common\$connection, MDB2_Driver_Common\getConnection(), PEAR\isError(), and MDB2_Driver_Common\raiseError().
Referenced by _getServerCapabilities(), and commit().
MDB2_Driver_mysql::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 | $table | name of the table into which a new row was inserted |
string | $field | name of the field into which a new row was inserted |
Reimplemented from MDB2_Driver_Common.
Definition at line 1101 of file mysql.php.
References MDB2_Driver_Common\queryOne().
Referenced by nextID().
MDB2_Driver_mysql::nextID | ( | $seq_name, | |
$ondemand = true |
|||
) |
Returns the next free id of a sequence.
string | $seq_name | name of the sequence |
boolean | $ondemand | when true the sequence is automatic created, if it not exists |
Reimplemented from MDB2_Driver_Common.
Definition at line 1057 of file mysql.php.
References $query, $result, _doQuery(), PEAR\expectError(), MDB2_Driver_Common\getSequenceName(), PEAR\isError(), lastInsertID(), MDB2_Driver_Common\loadModule(), MDB2_ERROR_NOSUCHTABLE, PEAR\popExpect(), MDB2_Driver_Common\quoteIdentifier(), and MDB2_Driver_Common\raiseError().
& MDB2_Driver_mysql::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 | $query | the query to prepare |
mixed | $types | array that contains the types of the placeholders |
mixed | $result_types | 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 | $lobs | key (field) value (parameter) pair for all lob placeholders |
Reimplemented from MDB2_Driver_Common.
Definition at line 836 of file mysql.php.
References MDB2_Driver_Common\$connection, $err, MDB2_Driver_Common\$limit, MDB2_Driver_Common\$offset, $query, $result, _doQuery(), _modifyQuery(), MDB2_Driver_Common\_skipDelimitedStrings(), _skipUserDefinedVariable(), MDB2_Driver_Common\debug(), elseif(), MDB2_Driver_Common\getConnection(), PEAR\isError(), MDB2_ERROR_SYNTAX, MDB2_PREPARE_MANIP, and MDB2_Driver_Common\raiseError().
MDB2_Driver_mysql::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 implements it natively, this type of query is emulated through this method for other DBMS using standard types of queries inside a transaction to assure the atomicity of the operation.
public
string | $table | name of the table on which the REPLACE query will be executed. |
array | $fields | 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 Metabase are supported except for clob and blob.
Default: no type conversion
null Boolean 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 Boolean 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
Reimplemented from MDB2_Driver_Common.
Definition at line 998 of file mysql.php.
References MDB2_Driver_Common\$connection, $name, $query, $result, $type, _affectedRows(), _doQuery(), MDB2_Driver_Common\getConnection(), PEAR\isError(), MDB2_ERROR_CANNOT_REPLACE, MDB2_Driver_Common\quote(), and MDB2_Driver_Common\raiseError().
MDB2_Driver_mysql::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 from MDB2_Driver_Common.
Definition at line 313 of file mysql.php.
References $query, $result, _doQuery(), MDB2_Driver_Common\debug(), PEAR\isError(), MDB2_ERROR_INVALID, MDB2_ERROR_UNSUPPORTED, MDB2_OK, MDB2_Driver_Common\raiseError(), and MDB2_Driver_Common\supports().
Referenced by disconnect().
MDB2_Driver_mysql::setCharset | ( | $charset, | |
$connection = null |
|||
) |
Set the charset on the current connection.
string | charset |
resource | connection handle |
Reimplemented from MDB2_Driver_Common.
Definition at line 509 of file mysql.php.
References MDB2_Driver_Common\$connection, $query, _doQuery(), MDB2_Driver_Common\getConnection(), and PEAR\isError().
Referenced by connect().
MDB2_Driver_mysql::setTransactionIsolation | ( | $isolation | ) |
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) |
public
Definition at line 361 of file mysql.php.
References $query, _doQuery(), MDB2_Driver_Common\debug(), MDB2_ERROR_UNSUPPORTED, MDB2_Driver_Common\raiseError(), and MDB2_Driver_Common\supports().
MDB2_Driver_mysql::$identifier_quoting = array('start' => '`', 'end' => '`', 'escape' => '`') |
MDB2_Driver_mysql::$sql_comments |
MDB2_Driver_mysql::$string_quoting = array('start' => "'", 'end' => "'", 'escape' => '\\', 'escape_pattern' => '\\') |