|
ILIAS
Release_3_10_x_branch Revision 61812
|
Database Wrapper. More...
Inheritance diagram for ilDBx:
Collaboration diagram for ilDBx:Public Member Functions | |
| ilDBx ($dsn) | |
| constructor | |
| _ilDBx () | |
| destructor | |
| disconnect () | |
| disconnect from database | |
| createTable ($a_name, $a_definition_array, $a_options="") | |
| Create a new table in the database. | |
| query ($sql) | |
| Simple query. | |
| manipulate ($sql) | |
| Simple data manipulatoin. | |
| prepare ($a_query, $a_types=null, $a_result_types=null) | |
| Prepare a query (SELECT) statement to be used with execute. | |
| prepareManip ($a_query, $a_types=null) | |
| Prepare a data manipulation statement to be used with execute. | |
| execute ($a_stmt, $a_data=null) | |
| Execute a query statement prepared by either prepare() or prepareManip() | |
| executeMultiple ($a_stmt, $a_data) | |
| Execute a query statement prepared by either prepare() or prepareManip() with multiple data arrays. | |
| fetchAssoc ($a_set) | |
| Fetch row as associative array from result set. | |
| fetchObject ($a_set) | |
| Fetch row as object from result set. | |
| getInClause ($a_field, $a_values) | |
| Get abstract in-clause for given array. | |
| addTypesToArray ($a_arr, $a_type, $a_cnt) | |
| Adds a type x times to an array. | |
| beginTransaction () | |
| Begin Transaction. | |
| commit () | |
| Commit a transaction. | |
| rollback () | |
| Rollback a transaction. | |
| getLastInsertId () | |
| get last insert id | |
| _lockTables ($a_table_params) | |
| Lock existing table. | |
| _unlockTables () | |
| getMySQLVersion () | |
| get mysql version | |
| isMysql4_0OrHigher () | |
| check wether current MySQL server is version 4.0.x or higher | |
| isMysql4_1 () | |
| check wether current MySQL server is version 4.1.x | |
| isMysql4_1OrHigher () | |
| check wether current MySQL server is version 4.1.x or higher | |
| checkQuerySize ($a_query) | |
| Check query size. | |
| autoExecute ($a_tablename, $a_fields, $a_mode=MDB2_AUTOQUERY_INSERT, $a_where=false) | |
| Wrapper for Pear autoExecute. | |
| tableColumnExists ($a_table, $a_column_name) | |
| Checks for the existence of a table column. | |
| listTables () | |
| Checks for the existence of a table column. | |
| quote ($a_query, $null_as_empty_string=true) | |
| Wrapper for quote method. | |
| getOne ($sql) | |
| getOne. | |
| getRow ($sql, $mode=DB_FETCHMODE_OBJECT) | |
| getRow. | |
Static Public Member Functions | |
| static | isDbError ($a_res) |
| Check error. | |
Data Fields | |
| $error_class | |
| $db | |
| $result | |
| $max_allowed_packet_size | |
Protected Member Functions | |
| loadMDB2Extensions () | |
| load additional mdb2 extensions and set their constants | |
Private Member Functions | |
| setMaxAllowedPacket () | |
| Set maximum allowed packet size. | |
Database Wrapper.
this class should extend PEAR::DB, add error Management in case of a db-error in any database query the ilDBx-class raises an error
public
Definition at line 48 of file class.ilDBx.php.
| ilDBx::_ilDBx | ( | ) |
destructor
Definition at line 139 of file class.ilDBx.php.
| ilDBx::_lockTables | ( | $a_table_params | ) |
Lock existing table.
| array | (tablename => lock type READ, WRITE, READ LOCAL or LOW_PRIORITY) e.g array('tree' => 'WRITE') |
Definition at line 472 of file class.ilDBx.php.
Referenced by ilTree\deleteTree(), ilTree\insertNode(), ilTree\moveTree(), ilTree\renumber(), and ilTree\saveSubTree().
Here is the caller graph for this function:| ilDBx::_unlockTables | ( | ) |
Definition at line 488 of file class.ilDBx.php.
Referenced by ilTree\deleteTree(), ilTree\insertNode(), ilTree\moveTree(), and ilTree\renumber().
Here is the caller graph for this function:| ilDBx::addTypesToArray | ( | $a_arr, | |
| $a_type, | |||
| $a_cnt | |||
| ) |
Adds a type x times to an array.
Definition at line 384 of file class.ilDBx.php.
| ilDBx::autoExecute | ( | $a_tablename, | |
| $a_fields, | |||
$a_mode = MDB2_AUTOQUERY_INSERT, |
|||
$a_where = false |
|||
| ) |
Wrapper for Pear autoExecute.
| string | tablename |
| array | fields values |
| int | MDB2_AUTOQUERY_INSERT or MDB2_AUTOQUERY_UPDATE |
| string | where condition (e.g. "obj_id = '7' AND ref_id = '5'") |
Definition at line 601 of file class.ilDBx.php.
| ilDBx::beginTransaction | ( | ) |
Begin Transaction.
Please note that we currently do not use savepoints.
Definition at line 411 of file class.ilDBx.php.
References $res.
| ilDBx::checkQuerySize | ( | $a_query | ) |
Check query size.
Definition at line 573 of file class.ilDBx.php.
References $lang.
| ilDBx::commit | ( | ) |
| ilDBx::createTable | ( | $a_name, | |
| $a_definition_array, | |||
$a_options = "" |
|||
| ) |
Create a new table in the database.
Definition at line 154 of file class.ilDBx.php.
| ilDBx::disconnect | ( | ) |
disconnect from database
Definition at line 146 of file class.ilDBx.php.
| ilDBx::execute | ( | $a_stmt, | |
$a_data = null |
|||
| ) |
Execute a query statement prepared by either prepare() or prepareManip()
| object | Resource handle of the prepared query. |
| array | Array of data (to be used for placeholders) |
Definition at line 309 of file class.ilDBx.php.
References $res.
| ilDBx::executeMultiple | ( | $a_stmt, | |
| $a_data | |||
| ) |
Execute a query statement prepared by either prepare() or prepareManip() with multiple data arrays.
| object | Resource handle of the prepared query. |
| array | Array of array of data (to be used for placeholders) |
Definition at line 332 of file class.ilDBx.php.
| ilDBx::fetchAssoc | ( | $a_set | ) |
Fetch row as associative array from result set.
| object | result set |
Definition at line 351 of file class.ilDBx.php.
References DB_FETCHMODE_ASSOC.
| ilDBx::fetchObject | ( | $a_set | ) |
Fetch row as object from result set.
| object | result set |
Definition at line 361 of file class.ilDBx.php.
References DB_FETCHMODE_OBJECT.
| ilDBx::getInClause | ( | $a_field, | |
| $a_values | |||
| ) |
Get abstract in-clause for given array.
Returns an array "field_name IN (?,?,?,...)" depending on the size of the array
Definition at line 370 of file class.ilDBx.php.
| ilDBx::getLastInsertId | ( | ) |
| ilDBx::getMySQLVersion | ( | ) |
get mysql version
Definition at line 500 of file class.ilDBx.php.
| ilDBx::getOne | ( | $sql | ) |
getOne.
DEPRECATED. Should not be used anymore.
this is the wrapper itself. Runs a query and returns the first column of the first row or in case of an error, jump to errorpage
| string |
Definition at line 761 of file class.ilDBx.php.
References DB_FETCHMODE_ASSOC.
| ilDBx::getRow | ( | $sql, | |
$mode = DB_FETCHMODE_OBJECT |
|||
| ) |
getRow.
DEPRECATED. Should not be used anymore
this is the wrapper itself. query a string, and return the resultobject, or in case of an error, jump to errorpage
| string |
Definition at line 787 of file class.ilDBx.php.
References query().
Here is the call graph for this function:| ilDBx::ilDBx | ( | $dsn | ) |
constructor
set up database conncetion and the errorhandling
| string | dsn database-connection-string for pear-db |
Definition at line 83 of file class.ilDBx.php.
References isDbError(), isMysql4_1OrHigher(), loadMDB2Extensions(), query(), and setMaxAllowedPacket().
Here is the call graph for this function:
|
static |
Check error.
Definition at line 400 of file class.ilDBx.php.
Referenced by ilObjChat\delete(), ilChatRecording\delete(), ilChatRoom\delete(), ilNestedSetXML\export(), ilChatRecording\exportMessages(), ilChatRecord\getRecord(), ilChatRecording\getRecord(), ilChatRecording\getRecordings(), ilDBx(), ilChatRecord\isRecording(), ilChatRecording\isRecording(), loadMDB2Extensions(), ilChatRecord\startRecording(), ilChatRecording\startRecording(), ilChatRecord\stopRecording(), and ilChatRecording\stopRecording().
Here is the caller graph for this function:| ilDBx::isMysql4_0OrHigher | ( | ) |
check wether current MySQL server is version 4.0.x or higher
Definition at line 509 of file class.ilDBx.php.
| ilDBx::isMysql4_1 | ( | ) |
check wether current MySQL server is version 4.1.x
Definition at line 522 of file class.ilDBx.php.
| ilDBx::isMysql4_1OrHigher | ( | ) |
check wether current MySQL server is version 4.1.x or higher
NOTE: Three sourcecodes use this or a similar handling:
Definition at line 541 of file class.ilDBx.php.
Referenced by ilDBx().
Here is the caller graph for this function:| ilDBx::listTables | ( | ) |
Checks for the existence of a table column.
| string | $a_table | The table name which should be examined |
| string | $a_column_name | The name of the column |
Definition at line 708 of file class.ilDBx.php.
|
protected |
load additional mdb2 extensions and set their constants
protected
Definition at line 558 of file class.ilDBx.php.
References isDbError().
Referenced by ilDBx().
Here is the call graph for this function:
Here is the caller graph for this function:| ilDBx::manipulate | ( | $sql | ) |
Simple data manipulatoin.
This function should only be used for simple data manipulations without parameters. Queries should not be done with it.
Example:
For simple data queries use query(). For complex queries/manipulations use prepare()/prepareManip() and execute.
| string | DML string |
Definition at line 244 of file class.ilDBx.php.
| ilDBx::prepare | ( | $a_query, | |
$a_types = null, |
|||
$a_result_types = null |
|||
| ) |
Prepare a query (SELECT) statement to be used with execute.
| String | Query String |
| Array | Placeholder Types |
Definition at line 267 of file class.ilDBx.php.
References $res.
| ilDBx::prepareManip | ( | $a_query, | |
$a_types = null |
|||
| ) |
Prepare a data manipulation statement to be used with execute.
| String | Query String |
| Array | Placeholder Types |
Definition at line 288 of file class.ilDBx.php.
References $res.
| ilDBx::query | ( | $sql | ) |
Simple query.
This function should only be used for simple select queries without parameters. Data manipulation should not be done with it.
Example:
For simple data manipulation use manipulate(). For complex queries/manipulations use prepare()/prepareManip() and execute.
| string |
Definition at line 188 of file class.ilDBx.php.
Referenced by getRow(), and ilDBx().
Here is the caller graph for this function:| ilDBx::quote | ( | $a_query, | |
$null_as_empty_string = true |
|||
| ) |
Wrapper for quote method.
Deprecated, use prepare/prepareManip instead.
Definition at line 730 of file class.ilDBx.php.
| ilDBx::rollback | ( | ) |
|
private |
Set maximum allowed packet size.
Definition at line 618 of file class.ilDBx.php.
References $res, and DB_FETCHMODE_OBJECT.
Referenced by ilDBx().
Here is the caller graph for this function:| ilDBx::tableColumnExists | ( | $a_table, | |
| $a_column_name | |||
| ) |
Checks for the existence of a table column.
| string | $a_table | The table name which should be examined |
| string | $a_column_name | The name of the column |
Definition at line 669 of file class.ilDBx.php.
| ilDBx::$db |
Definition at line 61 of file class.ilDBx.php.
| ilDBx::$error_class |
Definition at line 55 of file class.ilDBx.php.
| ilDBx::$max_allowed_packet_size |
Definition at line 73 of file class.ilDBx.php.
| ilDBx::$result |
Definition at line 67 of file class.ilDBx.php.