ILIAS
Release_4_0_x_branch Revision 61816
|
MySQL Database Wrapper. More...
Public Member Functions | |
getDSN () | |
Get DSN. | |
getHostDSN () | |
Get Host DSN. | |
getDBType () | |
Get DB Type. | |
initConnection () | |
Initialize the database connection. | |
now () | |
now() | |
optimizeTable ($a_table) | |
Optimize Table. | |
getDBVersion () | |
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. | |
supportsFulltext () | |
Is fulltext index supported? | |
addFulltextIndex ($a_table, $a_fields, $a_name="in") | |
Add fulltext index. | |
dropFulltextIndex ($a_table, $a_name) | |
Add fulltext index. | |
isFulltextIndex ($a_table, $a_name) | |
Is index a fulltext index? | |
lockTables ($a_tables) | |
Lock table. | |
unlockTables () | |
Unlock tables. | |
Public Member Functions inherited from ilDB | |
ilDB () | |
constructor | |
setDBUser ($a_user) | |
Set database user. | |
getDBUser () | |
Get database user. | |
setDBPort ($a_port) | |
Set database port. | |
getDBPort () | |
Get database port. | |
setDBHost ($a_host) | |
Set database host. | |
getDBHost () | |
Get database host. | |
setDBPassword ($a_password) | |
Set database password. | |
getDBPassword () | |
Get database password. | |
setDBName ($a_name) | |
Set database name. | |
getDBName () | |
Get database name. | |
initFromIniFile ($tmpClientIniFile=null) | |
Init db parameters from ini file. | |
connect ($a_return_false_for_error=false) | |
Open the connection. | |
doConnect () | |
Standard way to connect to db. | |
disconnect () | |
Disconnect. | |
connectHost () | |
Sets up a host connection only (no specific database used). | |
handleError ($a_res, $a_info="", $a_level="") | |
Handle MDB2 Errors. | |
raisePearError ($a_message, $a_level="") | |
Raise an error. | |
createDatabase ($a_name, $a_charset="utf8", $a_collation="") | |
Create database. | |
createTable ($a_name, $a_definition_array, $a_drop_table=false, $a_ignore_erros=false) | |
Create a new table in the database. | |
dropTable ($a_name, $a_error_if_not_existing=true) | |
Drop a table. | |
alterTable ($a_name, $a_changes) | |
Alter a table in the database This method is DEPRECATED, see http://www.ilias.de/docu/goto.php?target=pg_25354_42&client_id=docu PLEASE USE THE SPECIALIZED METHODS OF THIS CLASS TO CHANGE THE DB SCHEMA. | |
addTableColumn ($a_table, $a_column, $a_attributes) | |
Add table column Use this only on aleady "abstracted" tables. | |
dropTableColumn ($a_table, $a_column) | |
Drop table column Use this only on aleady "abstracted" tables. | |
modifyTableColumn ($a_table, $a_column, $a_attributes) | |
Modify a table column Use this only on aleady "abstracted" tables. | |
renameTableColumn ($a_table, $a_column, $a_new_column) | |
Rename a table column Use this only on aleady "abstracted" tables. | |
renameTable ($a_name, $a_new_name) | |
Rename a table. | |
addPrimaryKey ($a_table, $a_fields) | |
Add a primary key to a table. | |
getPrimaryKeyIdentifier () | |
Primary key identifier. | |
dropPrimaryKey ($a_table) | |
Drop a primary key from a table. | |
addIndex ($a_table, $a_fields, $a_name="in", $a_fulltext=false) | |
Add an index to a table. | |
dropIndex ($a_table, $a_name="in") | |
Drop an index from a table. | |
addUniqueConstraint ($a_table, $a_fields, $a_name="con") | |
Add a unique constraint to a table. | |
createSequence ($a_table_name, $a_start=1) | |
Create a sequence for a table. | |
dropSequence ($a_table_name) | |
Drop a sequence for a table. | |
checkTableName ($a_name) | |
Check whether a table name is valid. | |
checkTableColumns ($a_cols) | |
Check table columns definition. | |
checkColumn ($a_col, $a_def) | |
Check column definition. | |
checkColumnDefinition ($a_def, $a_modify_mode=false) | |
Check whether a column definition is valid. | |
checkColumnName ($a_name) | |
Check whether a column name is valid. | |
checkIndexName ($a_name) | |
Check whether an index name is valid. | |
getAllowedAttributes () | |
constraintName ($a_table, $a_constraint) | |
Determine contraint name by table name and constraint name. | |
query ($sql, $a_handle_error=true) | |
Query. | |
queryF ($a_query, $a_types, $a_values) | |
Formatted query (for SELECTS). | |
manipulateF ($a_query, $a_types, $a_values) | |
Formatted manupulate (for DELETE, UPDATE, INSERT). | |
logStatement ($sql) | |
Helper function, should usually not be called. | |
setLimit ($a_limit, $a_offset=0) | |
Set limit and offset for a query. | |
nextId ($a_table_name) | |
Get next ID for an index. | |
manipulate ($sql) | |
Data manipulation. | |
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. | |
insert ($a_table, $a_columns) | |
Convenient method for standard insert statements, example field array: | |
update ($a_table, $a_columns, $a_where) | |
Convenient method for standard update statements, example field array: | |
replace ($a_table, $a_pk_columns, $a_other_columns) | |
Replace into method. | |
fetchAssoc ($a_set) | |
Fetch row as associative array from result set. | |
free ($a_st) | |
Free a statement / result set. | |
fetchObject ($a_set) | |
Fetch row as object from result set. | |
numRows ($a_set) | |
Fetch row as associative array from result set. | |
in ($a_field, $a_values, $negate=false, $a_type="") | |
Get abstract in-clause for given array. | |
addTypesToArray ($a_arr, $a_type, $a_cnt) | |
Adds a type x times to an array. | |
concat ($a_values, $a_allow_null=true) | |
Abstraction of SQL function CONCAT. | |
locate ($a_needle, $a_string, $a_start_pos=1) | |
Create locate string. | |
like ($a_col, $a_type, $a_value="?", $case_insensitive=true) | |
Like. | |
equals ($a_col, $a_value, $a_type, $a_empty_or_null=false) | |
Use this only on text fields. | |
equalsNot ($a_col, $a_value, $a_type, $a_empty_or_null=false) | |
Use this only on text fields. | |
fromUnixtime ($a_expr, $a_to_text=true) | |
fromUnixtime (makes timestamp out of unix timestamp) | |
unixTimestamp () | |
Unix timestamp. | |
tableExists ($a_table) | |
Check, whether a given table exists. | |
tableColumnExists ($a_table, $a_column_name) | |
Checks for the existence of a table column. | |
listTables () | |
Get all tables. | |
quote ($a_query, $a_type=null) | |
Wrapper for quote method. | |
quoteIdentifier ($a_identifier) | |
Quote table and field names. | |
beginTransaction () | |
Begin Transaction. | |
commit () | |
Commit a transaction. | |
rollback () | |
Rollback a transaction. | |
autoExecute ($a_tablename, $a_fields, $a_mode=MDB2_AUTOQUERY_INSERT, $a_where=false) | |
Wrapper for Pear autoExecute. | |
getLastInsertId () | |
Get last insert id. | |
getOne ($sql) | |
getOne. | |
getRow ($sql, $mode=DB_FETCHMODE_OBJECT) | |
getRow. | |
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. |
Static Public Member Functions | |
static | getReservedWords () |
Get reserved words. | |
Static Public Member Functions inherited from ilDB | |
static | isDbError ($a_res) |
Check error. | |
static | isReservedWord ($a_word) |
Checks whether a word is a reserved word in one of the supported databases. |
Data Fields | |
$max_allowed_packet_size | |
Data Fields inherited from ilDB | |
const | LOCK_WRITE = 1 |
const | LOCK_READ = 2 |
$error_class | |
$db | |
$result | |
$allowed_attributes | |
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() |
Private Member Functions | |
setMaxAllowedPacket () | |
Set maximum allowed packet size. |
Additional Inherited Members | |
Protected Member Functions inherited from ilDB | |
initHostConnection () | |
Initialize the host connection (no specific database) | |
loadMDB2Extensions () | |
load additional mdb2 extensions and set their constants |
MySQL Database Wrapper.
This class extends the main ILIAS database wrapper ilDB. Only a few methods should be overwritten, that contain MySQL specific statements and methods.
Definition at line 18 of file class.ilDBMySQL.php.
ilDBMySQL::addFulltextIndex | ( | $a_table, | |
$a_fields, | |||
$a_name = "in" |
|||
) |
Add fulltext index.
Reimplemented from ilDB.
Definition at line 270 of file class.ilDBMySQL.php.
References $q, ilDB\constraintName(), and ilDB\query().
ilDBMySQL::checkQuerySize | ( | $a_query | ) |
Check query size.
Definition at line 207 of file class.ilDBMySQL.php.
References $lang.
ilDBMySQL::dropFulltextIndex | ( | $a_table, | |
$a_name | |||
) |
Add fulltext index.
Definition at line 281 of file class.ilDBMySQL.php.
References ilDB\constraintName(), and ilDB\query().
ilDBMySQL::getDBType | ( | ) |
Get DB Type.
Reimplemented from ilDB.
Definition at line 53 of file class.ilDBMySQL.php.
ilDBMySQL::getDBVersion | ( | ) |
get mysql version
Reimplemented from ilDB.
Definition at line 147 of file class.ilDBMySQL.php.
Referenced by isMysql4_0OrHigher(), isMysql4_1(), and isMysql4_1OrHigher().
ilDBMySQL::getDSN | ( | ) |
Get DSN.
Reimplemented from ilDB.
Definition at line 29 of file class.ilDBMySQL.php.
References ilDB\getDBName(), and ilDB\getDBPassword().
ilDBMySQL::getHostDSN | ( | ) |
Get Host DSN.
Reimplemented from ilDB.
Definition at line 44 of file class.ilDBMySQL.php.
References ilDB\getDBPassword().
|
static |
Get reserved words.
Reimplemented from ilDB.
Definition at line 61 of file class.ilDBMySQL.php.
ilDBMySQL::initConnection | ( | ) |
Initialize the database connection.
Reimplemented from ilDB.
Definition at line 110 of file class.ilDBMySQL.php.
References ilDB\query(), and setMaxAllowedPacket().
ilDBMySQL::isFulltextIndex | ( | $a_table, | |
$a_name | |||
) |
Is index a fulltext index?
Reimplemented from ilDB.
Definition at line 290 of file class.ilDBMySQL.php.
References ilDB\fetchAssoc(), and ilDB\query().
ilDBMySQL::isMysql4_0OrHigher | ( | ) |
check wether current MySQL server is version 4.0.x or higher
Definition at line 161 of file class.ilDBMySQL.php.
References getDBVersion().
ilDBMySQL::isMysql4_1 | ( | ) |
check wether current MySQL server is version 4.1.x
Definition at line 174 of file class.ilDBMySQL.php.
References getDBVersion().
ilDBMySQL::isMysql4_1OrHigher | ( | ) |
check wether current MySQL server is version 4.1.x or higher
NOTE: Two sourcecodes use this or a similar handling:
Definition at line 192 of file class.ilDBMySQL.php.
References getDBVersion().
ilDBMySQL::lockTables | ( | $a_tables | ) |
Lock table.
E.g $ilDB->lockTable('tree',ilDB::LOCK_WRITE,'t1')
array | $a_tables | |
int | $a_mode | |
string | $a_alias |
Reimplemented from ilDB.
Definition at line 311 of file class.ilDBMySQL.php.
References $ilLog, ilDB\LOCK_READ, ilDB\LOCK_WRITE, and ilDB\query().
ilDBMySQL::now | ( | ) |
ilDBMySQL::optimizeTable | ( | $a_table | ) |
Optimize Table.
Reimplemented from ilDB.
Definition at line 139 of file class.ilDBMySQL.php.
References ilDB\query().
|
private |
Set maximum allowed packet size.
todo@: This is MySQL specific and should go to a MySQL specific class.
Definition at line 226 of file class.ilDBMySQL.php.
References $query, $res, $row, DB_FETCHMODE_OBJECT, and ilDB\query().
Referenced by initConnection().
ilDBMySQL::supportsFulltext | ( | ) |
Is fulltext index supported?
Reimplemented from ilDB.
Definition at line 262 of file class.ilDBMySQL.php.
ilDBMySQL::unlockTables | ( | ) |
Unlock tables.
Reimplemented from ilDB.
Definition at line 350 of file class.ilDBMySQL.php.
References ilDB\query().
ilDBMySQL::$max_allowed_packet_size |
Definition at line 24 of file class.ilDBMySQL.php.