ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilDBInterface Interface Reference

Interface ilDBInterface. More...

+ Inheritance diagram for ilDBInterface:
+ Collaboration diagram for ilDBInterface:

Public Member Functions

 doesCollationSupportMB4Strings ()
 
 sanitizeMB4StringIfNotSupported ($query)
 
 initFromIniFile ($tmpClientIniFile=null)
 
 connect ($return_false_on_error=false)
 
 nextId ($table_name)
 
 createTable ($table_name, $fields, $drop_table=false, $ignore_erros=false)
 
 addPrimaryKey ($table_name, $primary_keys)
 
 createSequence ($table_name, $start=1)
 
 getSequenceName ($table_name)
 
 tableExists ($table_name)
 
 tableColumnExists ($table_name, $column_name)
 
 addTableColumn ($table_name, $column_name, $attributes)
 
 dropTable ($table_name, $error_if_not_existing=true)
 
 renameTable ($old_name, $new_name)
 
 query ($query)
 Run a (read-only) Query on the database. More...
 
 fetchAll ($query_result, $fetch_mode=ilDBConstants::FETCHMODE_ASSOC)
 
 dropSequence ($table_name)
 
 dropTableColumn ($table_name, $column_name)
 
 renameTableColumn ($table_name, $column_old_name, $column_new_name)
 
 insert ($table_name, $values)
 
 fetchObject ($query_result)
 
 update ($table_name, $values, $where)
 
 manipulate ($query)
 Run a (write) Query on the database. More...
 
 fetchAssoc ($query_result)
 
 numRows ($query_result)
 
 quote ($value, $type)
 
 addIndex ($table_name, $fields, $index_name='', $fulltext=false)
 
 indexExistsByFields ($table_name, $fields)
 
 getDSN ()
 Get DSN. More...
 
 getDBType ()
 Get DSN. More...
 
 lockTables ($tables)
 Abstraction of lock table. More...
 
 unlockTables ()
 Unlock tables locked by previous lock table calls. More...
 
 in ($field, $values, $negate=false, $type="")
 
 queryF ($query, $types, $values)
 
 manipulateF ($query, $types, $values)
 
 useSlave ($bool)
 Return false iff slave is not supported. More...
 
 setLimit ($limit, $offset)
 
 like ($column, $type, $value="?", $case_insensitive=true)
 Generate a like subquery. More...
 
 now ()
 
 replace ($table, $primaryKeys, $otherColumns)
 Replace into method. More...
 
 equals ($columns, $value, $type, $emptyOrNull=false)
 
 setDBUser ($user)
 
 setDBPort ($port)
 
 setDBPassword ($password)
 
 setDBHost ($host)
 
 upper ($a_exp)
 
 lower ($a_exp)
 
 substr ($a_exp)
 
 prepare ($a_query, $a_types=null, $a_result_types=null)
 Prepare a query (SELECT) statement to be used with execute. More...
 
 prepareManip ($a_query, $a_types=null)
 
 enableResultBuffering ($a_status)
 
 execute ($stmt, $data=array())
 
 sequenceExists ($sequence)
 
 listSequences ()
 
 supports ($feature)
 
 supportsFulltext ()
 
 supportsSlave ()
 
 supportsTransactions ()
 
 listTables ()
 
 loadModule ($module)
 
 getAllowedAttributes ()
 
 concat (array $values, $allow_null=true)
 
 locate ($a_needle, $a_string, $a_start_pos=1)
 
 quoteIdentifier ($identifier, $check_option=false)
 
 modifyTableColumn ($table, $column, $attributes)
 
 free ($a_st)
 
 checkTableName ($a_name)
 
 beginTransaction ()
 
 commit ()
 
 rollback ()
 
 constraintName ($a_table, $a_constraint)
 
 dropIndex ($a_table, $a_name="i1")
 
 createDatabase ($a_name, $a_charset="utf8", $a_collation="")
 
 dropIndexByFields ($table_name, $afields)
 
 getPrimaryKeyIdentifier ()
 
 addFulltextIndex ($table_name, $afields, $a_name='in')
 
 dropFulltextIndex ($a_table, $a_name)
 
 isFulltextIndex ($a_table, $a_name)
 
 setStorageEngine ($storage_engine)
 
 getStorageEngine ()
 
 buildAtomQuery ()
 
 groupConcat ($a_field_name, $a_seperator=",", $a_order=null)
 
 cast ($a_field_name, $a_dest_type)
 

Static Public Member Functions

static getReservedWords ()
 Get reserved words. More...
 
static isReservedWord ($a_word)
 

Detailed Description

Member Function Documentation

◆ addFulltextIndex()

ilDBInterface::addFulltextIndex (   $table_name,
  $afields,
  $a_name = 'in' 
)
Parameters
$table_name
$afields
string$a_name
Returns
bool

Implemented in ilDBPdo, and ilDBPdoMySQLInnoDB.

◆ addIndex()

ilDBInterface::addIndex (   $table_name,
  $fields,
  $index_name = '',
  $fulltext = false 
)
Parameters
$table_name
$fields
string$index_name
bool$fulltext
Returns
bool

Implemented in ilDBPdo, and ilDBPdoPostgreSQL.

◆ addPrimaryKey()

ilDBInterface::addPrimaryKey (   $table_name,
  $primary_keys 
)
Parameters
$table_namestring
$primary_keysarray

Implemented in ilDBPdoPostgreSQL, and ilDBPdo.

◆ addTableColumn()

ilDBInterface::addTableColumn (   $table_name,
  $column_name,
  $attributes 
)
Parameters
$table_namestring
$column_namestring
$attributesarray

Implemented in ilDBPdo.

Referenced by ilDBUpdateNewObjectType\varchar2text().

+ Here is the caller graph for this function:

◆ beginTransaction()

ilDBInterface::beginTransaction ( )
Returns
bool
Exceptions

Implemented in ilDBPdo.

◆ buildAtomQuery()

ilDBInterface::buildAtomQuery ( )
Returns

Implemented in ilDBPdo, and ilDBPdoMySQLGalera.

Referenced by ilChangeEvent\_syncObjectStats().

+ Here is the caller graph for this function:

◆ cast()

ilDBInterface::cast (   $a_field_name,
  $a_dest_type 
)
Parameters
string$a_field_name
string$a_dest_type
Returns
string;

Implemented in ilDBPdo.

◆ checkTableName()

ilDBInterface::checkTableName (   $a_name)
Parameters
$a_name
Returns
bool

Implemented in ilDBPdo.

◆ commit()

ilDBInterface::commit ( )
Returns
bool
Exceptions

Implemented in ilDBPdo.

◆ concat()

ilDBInterface::concat ( array  $values,
  $allow_null = true 
)
Parameters
array$values
bool$allow_null
Returns
mixed

Implemented in ilDBPdo.

◆ connect()

ilDBInterface::connect (   $return_false_on_error = false)
Parameters
bool$return_false_on_error
Returns
mixed

Implemented in ilDBPdo, and ilDBPdoPostgreSQL.

Referenced by ilDatabaseBaseTest\connect(), and ilDatabaseImplementationBaseTest\connect().

+ Here is the caller graph for this function:

◆ constraintName()

ilDBInterface::constraintName (   $a_table,
  $a_constraint 
)
Parameters
$a_table
$a_constraint
Returns
string

Implemented in ilDBPdo, and ilDBPdoPostgreSQL.

◆ createDatabase()

ilDBInterface::createDatabase (   $a_name,
  $a_charset = "utf8",
  $a_collation = "" 
)
Parameters
$a_name
string$a_charset
string$a_collation
Returns
mixed

Implemented in ilDBPdo.

◆ createSequence()

ilDBInterface::createSequence (   $table_name,
  $start = 1 
)
Parameters
$table_name
int$start

Implemented in ilDBPdo, and ilDBPdoPostgreSQL.

◆ createTable()

ilDBInterface::createTable (   $table_name,
  $fields,
  $drop_table = false,
  $ignore_erros = false 
)
Parameters
$table_name
$fields
bool$drop_table
bool$ignore_erros
Returns
mixed

Implemented in ilDBPdoPostgreSQL, and ilDBPdo.

◆ doesCollationSupportMB4Strings()

ilDBInterface::doesCollationSupportMB4Strings ( )
Returns
bool

Implemented in ilDBPdo, and ilDBPdoMySQL.

◆ dropFulltextIndex()

ilDBInterface::dropFulltextIndex (   $a_table,
  $a_name 
)
Parameters
$a_table
$a_name
Returns
bool

Implemented in ilDBPdo.

◆ dropIndex()

ilDBInterface::dropIndex (   $a_table,
  $a_name = "i1" 
)
Parameters
$a_table
string$a_name
Returns
bool

Implemented in ilDBPdo.

◆ dropIndexByFields()

ilDBInterface::dropIndexByFields (   $table_name,
  $afields 
)
Parameters
$table_name
$afields
Returns
bool

Implemented in ilDBPdo.

◆ dropSequence()

ilDBInterface::dropSequence (   $table_name)
Parameters
$table_namestring

Implemented in ilDBPdo.

◆ dropTable()

ilDBInterface::dropTable (   $table_name,
  $error_if_not_existing = true 
)
Parameters
$table_name
bool$error_if_not_existing
Returns
bool

Implemented in ilDBPdo, and ilDBPdoPostgreSQL.

◆ dropTableColumn()

ilDBInterface::dropTableColumn (   $table_name,
  $column_name 
)
Parameters
$table_namestring
$column_namestring

Implemented in ilDBPdo.

Referenced by ilDBUpdateNewObjectType\varchar2text().

+ Here is the caller graph for this function:

◆ enableResultBuffering()

ilDBInterface::enableResultBuffering (   $a_status)
Parameters
$a_status

Implemented in ilDBPdo.

◆ equals()

ilDBInterface::equals (   $columns,
  $value,
  $type,
  $emptyOrNull = false 
)
Parameters
$columns
$value
$type
bool$emptyOrNull
Returns
string

Implemented in ilDBPdo.

◆ execute()

ilDBInterface::execute (   $stmt,
  $data = array() 
)
Parameters
$stmt
array$data
Exceptions
ilDatabaseException
Returns
ilDBStatement

Referenced by ilDBPdo\autoExecute(), ilDBPdo\enableResultBuffering(), and ilDBPdo\update().

+ Here is the caller graph for this function:

◆ fetchAll()

ilDBInterface::fetchAll (   $query_result,
  $fetch_mode = ilDBConstants::FETCHMODE_ASSOC 
)
Parameters
$query_result
int$fetch_mode
Returns
array

Referenced by ilDBPdo\query().

+ Here is the caller graph for this function:

◆ fetchAssoc()

ilDBInterface::fetchAssoc (   $query_result)

◆ fetchObject()

ilDBInterface::fetchObject (   $query_result)
Parameters
$query_resultPDOStatement
Returns
mixed|null

Implemented in ilDBPdo.

◆ free()

ilDBInterface::free (   $a_st)
Parameters
$a_st
Returns
mixed

Referenced by ilDBPdo\autoExecute(), ilDBPdo\modifyTableColumn(), and ilDBPdo\update().

+ Here is the caller graph for this function:

◆ getAllowedAttributes()

ilDBInterface::getAllowedAttributes ( )
Returns
array

Implemented in ilDBPdo.

◆ getDBType()

ilDBInterface::getDBType ( )

Get DSN.

This must be overwritten in DBMS specific class.

Implemented in ilDBPdo.

Referenced by ilDatabaseAtomBaseTest\testWrongIsolationLevel().

+ Here is the caller graph for this function:

◆ getDSN()

ilDBInterface::getDSN ( )

Get DSN.

Parameters
int$fetchMode
Returns
mixed This must be overwritten in DBMS specific class.

Implemented in ilDBPdo.

◆ getPrimaryKeyIdentifier()

ilDBInterface::getPrimaryKeyIdentifier ( )
Returns
string

Implemented in ilDBPdo, and ilDBPdoPostgreSQL.

◆ getReservedWords()

static ilDBInterface::getReservedWords ( )
static

Get reserved words.

This must be overwritten in DBMS specific class. This is mainly used to check whether a new identifier can be problematic because it is a reserved word. So createTable / alterTable usually check these.

Referenced by ilDBPdo\setDBType().

+ Here is the caller graph for this function:

◆ getSequenceName()

ilDBInterface::getSequenceName (   $table_name)
Parameters
$table_name
Returns
string

Implemented in ilDBPdo.

◆ getStorageEngine()

ilDBInterface::getStorageEngine ( )
Returns
string

Implemented in ilDBPdo, and ilDBPdoPostgreSQL.

◆ groupConcat()

ilDBInterface::groupConcat (   $a_field_name,
  $a_seperator = ",",
  $a_order = null 
)
Parameters
string$a_field_name
string$a_seperator
string$a_order
Returns
string

Implemented in ilDBPdo.

◆ in()

ilDBInterface::in (   $field,
  $values,
  $negate = false,
  $type = "" 
)
Parameters
$fieldstring
$valuesarray
bool$negate
string$type
Returns
string

Implemented in ilDBPdo.

Referenced by ilRbacAdmin\assignUserLimited().

+ Here is the caller graph for this function:

◆ indexExistsByFields()

ilDBInterface::indexExistsByFields (   $table_name,
  $fields 
)
Parameters
$table_name
$fields
Returns
mixed

Implemented in ilDBPdo.

◆ initFromIniFile()

ilDBInterface::initFromIniFile (   $tmpClientIniFile = null)
Parameters
null$tmpClientIniFile

Implemented in ilDBPdo.

Referenced by ilDatabaseBaseTest\connect(), and ilDatabaseImplementationBaseTest\connect().

+ Here is the caller graph for this function:

◆ insert()

ilDBInterface::insert (   $table_name,
  $values 
)
Parameters
$table_namestring
$values
Returns
int|void

Implemented in ilDBPdo.

Referenced by ilChangeEvent\_syncObjectStats(), and ilSessionStatistics\createNewAggregationSlot().

+ Here is the caller graph for this function:

◆ isFulltextIndex()

ilDBInterface::isFulltextIndex (   $a_table,
  $a_name 
)
Parameters
$a_table
$a_name
Returns
bool

Implemented in ilDBPdo.

◆ isReservedWord()

static ilDBInterface::isReservedWord (   $a_word)
static
Parameters
$a_word
Returns
bool

Implemented in ilDBPdo.

Referenced by ilDatabaseReservedWordsTest\testReservedPDO().

+ Here is the caller graph for this function:

◆ like()

ilDBInterface::like (   $column,
  $type,
  $value = "?",
  $case_insensitive = true 
)

Generate a like subquery.

Parameters
string$column
string$type
mixed$value
bool$case_insensitive
Returns
string

Implemented in ilDBPdo.

◆ listSequences()

ilDBInterface::listSequences ( )
Returns
array

Implemented in ilDBPdo.

◆ listTables()

ilDBInterface::listTables ( )
Returns
array

Implemented in ilDBPdo.

Referenced by ilAtomQueryTestHelper\__invoke().

+ Here is the caller graph for this function:

◆ loadModule()

ilDBInterface::loadModule (   $module)
Parameters
string$moduleManager|Reverse
Returns
ilDBReverse|ilDBManager

Implemented in ilDBPdo.

◆ locate()

ilDBInterface::locate (   $a_needle,
  $a_string,
  $a_start_pos = 1 
)
Parameters
$a_needle
$a_string
int$a_start_pos
Returns
mixed

Implemented in ilDBPdo.

◆ lockTables()

ilDBInterface::lockTables (   $tables)

Abstraction of lock table.

Deprecated:
Use ilAtomQuery instead
Parameters
arraytable definitions
Returns

Implemented in ilDBPdo, and ilDBPdoPostgreSQL.

◆ lower()

ilDBInterface::lower (   $a_exp)
Parameters
$a_exp
Returns
string

Implemented in ilDBPdo.

◆ manipulate()

ilDBInterface::manipulate (   $query)

Run a (write) Query on the database.

The implementation MUST start and stop a $ilBench Database-Benchmark, e.g.:

$ilBench->startDbBench($sql); .... [run the query] $ilBench->stopDbBench();

Parameters
$querystring
Returns
int|void

Implemented in ilDBPdo.

Referenced by ilRbacAdmin\assignUserLimited(), ilGlossaryDefinition\create(), ilObjectActivation\createDefaultEntry(), ilGlossaryDefinition\delete(), ilWikiUserHTMLExport\getProcess(), ilGlossaryDefinition\moveDown(), ilGlossaryDefinition\moveUp(), ilDBUpdateNewObjectType\varchar2text(), and ilWikiStat\writeData().

+ Here is the caller graph for this function:

◆ manipulateF()

ilDBInterface::manipulateF (   $query,
  $types,
  $values 
)
Parameters
$querystring
$typesstring[]
$valuesmixed[]
Returns
string

Implemented in ilDBPdo.

Referenced by ilForumTopic\movePosts().

+ Here is the caller graph for this function:

◆ modifyTableColumn()

ilDBInterface::modifyTableColumn (   $table,
  $column,
  $attributes 
)
Parameters
$table
$column
$attributes
Returns
bool

Implemented in ilDBPdo.

◆ nextId()

ilDBInterface::nextId (   $table_name)
Parameters
$table_namestring
Returns
int

Implemented in ilDBPdoPostgreSQL, ilDBPdo, and ilDBPdoMySQL.

◆ now()

ilDBInterface::now ( )
Returns
string the now statement

Implemented in ilDBPdo.

◆ numRows()

ilDBInterface::numRows (   $query_result)
Parameters
$query_resultPDOStatement
Returns
int

Implemented in ilDBPdo.

Referenced by ilChangeEvent\_syncObjectStats(), ilObjectActivation\createDefaultEntry(), and ilWikiStat\writeData().

+ Here is the caller graph for this function:

◆ prepare()

ilDBInterface::prepare (   $a_query,
  $a_types = null,
  $a_result_types = null 
)

Prepare a query (SELECT) statement to be used with execute.

Parameters
string$a_query
Returns

Implemented in ilDBPdo, and ilDBPdoInterface.

◆ prepareManip()

ilDBInterface::prepareManip (   $a_query,
  $a_types = null 
)
Parameters
$a_query
null$a_types
Returns
ilDBStatement

Implemented in ilDBPdo.

◆ query()

ilDBInterface::query (   $query)

Run a (read-only) Query on the database.

The implementation MUST start and stop a $ilBench Database-Benchmark, e.g.:

$ilBench->startDbBench($sql); .... [run the query] $ilBench->stopDbBench();

Parameters
$querystring
Returns

Implemented in ilDBPdo.

Referenced by ilChangeEvent\_syncObjectStats(), ilRbacAdmin\assignUserLimited(), ilGlossaryDefinition\create(), ilObjectActivation\createDefaultEntry(), ilGlossaryDefinition\delete(), ilGlossaryDefinition\moveDown(), ilGlossaryDefinition\moveUp(), and ilWikiStat\writeData().

+ Here is the caller graph for this function:

◆ queryF()

ilDBInterface::queryF (   $query,
  $types,
  $values 
)
Parameters
$querystring
$typesstring[]
$valuesmixed[]
Returns

Implemented in ilDBPdo.

Referenced by ilObjTestDynamicQuestionSetConfig\getPoolQuestionChangeListener().

+ Here is the caller graph for this function:

◆ quote()

◆ quoteIdentifier()

ilDBInterface::quoteIdentifier (   $identifier,
  $check_option = false 
)
Parameters
$identifier
bool$check_option
Returns
string

Implemented in ilDBPdoPostgreSQL, and ilDBPdo.

◆ renameTable()

ilDBInterface::renameTable (   $old_name,
  $new_name 
)
Parameters
$old_name
$new_name
Returns
mixed

Implemented in ilDBPdo, and ilDBPdoPostgreSQL.

◆ renameTableColumn()

ilDBInterface::renameTableColumn (   $table_name,
  $column_old_name,
  $column_new_name 
)
Parameters
$table_namestring
$column_old_namestring
$column_new_namestring

Implemented in ilDBPdo.

Referenced by ilDBUpdateNewObjectType\varchar2text().

+ Here is the caller graph for this function:

◆ replace()

ilDBInterface::replace (   $table,
  $primaryKeys,
  $otherColumns 
)

Replace into method.

Parameters
stringtable name
arrayprimary key values: array("field1" => array("text", $name), "field2" => ...)
arrayother values: array("field1" => array("text", $name), "field2" => ...)

Implemented in ilDBPdo, and ilDBPdoPostgreSQL.

◆ rollback()

ilDBInterface::rollback ( )
Returns
bool
Exceptions

Implemented in ilDBPdo.

◆ sanitizeMB4StringIfNotSupported()

ilDBInterface::sanitizeMB4StringIfNotSupported (   $query)
Parameters
$querystring to sanitize, all MB4-Characters like emojis will re replaced with ???
Returns
string sanitized query

Implemented in ilDBPdo.

◆ sequenceExists()

ilDBInterface::sequenceExists (   $sequence)
Parameters
$sequence
Returns
mixed

Implemented in ilDBPdo.

◆ setDBHost()

ilDBInterface::setDBHost (   $host)
Parameters
$host

Implemented in ilDBPdo.

◆ setDBPassword()

ilDBInterface::setDBPassword (   $password)
Parameters
$password

Implemented in ilDBPdo.

◆ setDBPort()

ilDBInterface::setDBPort (   $port)
Parameters
$port

Implemented in ilDBPdo.

◆ setDBUser()

ilDBInterface::setDBUser (   $user)
Parameters
$user

Implemented in ilDBPdo.

◆ setLimit()

ilDBInterface::setLimit (   $limit,
  $offset 
)
Parameters
$limit
$offset

Implemented in ilDBPdo.

◆ setStorageEngine()

ilDBInterface::setStorageEngine (   $storage_engine)
Parameters
$storage_engine

Implemented in ilDBPdo, and ilDBPdoPostgreSQL.

◆ substr()

ilDBInterface::substr (   $a_exp)
Parameters
$a_exp
Returns
string

◆ supports()

ilDBInterface::supports (   $feature)
Parameters
$feature
Returns
bool

Implemented in ilDBPdo.

◆ supportsFulltext()

ilDBInterface::supportsFulltext ( )
Returns
bool

Implemented in ilDBPdo, ilDBPdoPostgreSQL, ilDBPdoMySQLInnoDB, and ilDBPdoMySQLMyISAM.

◆ supportsSlave()

ilDBInterface::supportsSlave ( )
Returns
bool

Implemented in ilDBPdo.

◆ supportsTransactions()

ilDBInterface::supportsTransactions ( )

◆ tableColumnExists()

ilDBInterface::tableColumnExists (   $table_name,
  $column_name 
)
Parameters
$table_namestring
$column_namestring
Returns
bool

Implemented in ilDBPdo, and ilDBPdoPostgreSQL.

◆ tableExists()

ilDBInterface::tableExists (   $table_name)
Parameters
$table_namestring
Returns
bool

Implemented in ilDBPdo, and ilDBPdoPostgreSQL.

◆ unlockTables()

ilDBInterface::unlockTables ( )

Unlock tables locked by previous lock table calls.

Deprecated:
Use ilAtomQuery instead
Returns

Implemented in ilDBPdo, and ilDBPdoPostgreSQL.

◆ update()

ilDBInterface::update (   $table_name,
  $values,
  $where 
)
Parameters
$table_namestring
$valuesarray
$wherearray
Returns
int|void

Implemented in ilDBPdo.

Referenced by ilChangeEvent\_syncObjectStats(), and ilLSStateDB\update().

+ Here is the caller graph for this function:

◆ upper()

ilDBInterface::upper (   $a_exp)
Parameters
$a_exp
Returns
string

Implemented in ilDBPdo.

◆ useSlave()

ilDBInterface::useSlave (   $bool)

Return false iff slave is not supported.

Parameters
$bool
Returns
bool

Implemented in ilDBPdo.


The documentation for this interface was generated from the following file: