5include_once(
"./Services/Database/classes/MDB2/class.ilDB.php");
 
   37        if (!isset(
$GLOBALS[
'_MDB2_dsninfo_default'][
'charset']) or
 
   38            $GLOBALS[
'_MDB2_dsninfo_default'][
'charset'] != 
'utf8') {
 
   39            $GLOBALS[
'_MDB2_dsninfo_default'][
'charset'] = 
'utf8';
 
   42        return array(
'phptype' => 
'oci8',
 
   64        $query = 
'SELECT * FROM v$version';
 
   68            return parent::getDBVersion();
 
   71        return isset(
$row[
'banner']) ? 
$row[
'banner'] : parent::getDBVersion();
 
   82            "ACCESS", 
"ADD", 
"ALL", 
"ALTER", 
"AND", 
"ANY", 
"AS", 
"ASC",
 
   83            "AUDIT", 
"BETWEEN", 
"BY", 
"CHAR", 
"CHECK", 
"CLUSTER", 
"COLUMN",
 
   84            "COMMENT", 
"COMPRESS", 
"CONNECT", 
"CREATE", 
"CURRENT", 
"DATE",
 
   85            "DECIMAL", 
"DEFAULT", 
"DELETE", 
"DESC", 
"DISTINCT", 
"DROP", 
"ELSE",
 
   86            "EXCLUSIVE", 
"EXISTS", 
"FILE", 
"FLOAT", 
"FOR", 
"FROM", 
"GRANT", 
"GROUP",
 
   87            "HAVING", 
"IDENTIFIED", 
"IMMEDIATE", 
"IN", 
"INCREMENT", 
"INDEX", 
"INITIAL",
 
   88            "INSERT", 
"INTEGER", 
"INTERSECT", 
"INTO", 
"IS", 
"LEVEL", 
"LIKE", 
"LOCK", 
"LONG",
 
   89            "MAXEXTENTS", 
"MINUS", 
"MLSLABEL", 
"MODE", 
"MODIFY", 
"NOAUDIT", 
"NOCOMPRESS", 
"NOT",
 
   90            "NOWAIT", 
"NULL", 
"NUMBER", 
"OF", 
"OFFLINE", 
"ON", 
"ONLINE",
"OPTION",
 
   91            "OR", 
"ORDER", 
"PCTFREE", 
"PRIOR", 
"PRIVILEGES", 
"PUBLIC", 
"RAW", 
"RENAME",
 
   92            "RESOURCE", 
"REVOKE", 
"ROW", 
"ROWID", 
"ROWNUM", 
"ROWS", 
"SELECT", 
"SESSION", 
"SET",
 
   93            "SHARE", 
"SIZE", 
"SMALLINT", 
"START", 
"SUCCESSFUL", 
"SYNONYM", 
"SYSDATE",
"TABLE",
 
   94            "THEN", 
"TO", 
"TRIGGER", 
"UID", 
"UNION", 
"UNIQUE", 
"UPDATE", 
"USER",
"VALIDATE",
 
   95            "VALUES", 
"VARCHAR", 
"VARCHAR2", 
"VIEW", 
"WHENEVER", 
"WHERE", 
"WITH" 
  106            array(
"use_transactions" => 
true)
 
  115        $GLOBALS[
'_MDB2_dsninfo_default'][
'charset'] = 
'utf8';
 
  116        $this->
query(
"ALTER SESSION SET nls_length_semantics='CHAR'");
 
  117        $this->
query(
"ALTER SESSION SET NLS_SORT = binary_ci");
 
  137        return "LOCALTIMESTAMP";
 
  146            return "TO_DATE('19700101000000','YYYYMMDDHH24MISS') " .
 
  147                "+ NUMTODSINTERVAL(" . $a_expr . 
", 'SECOND')";
 
  149            return "to_char(TO_DATE('19700101000000','YYYYMMDDHH24MISS') " .
 
  150                "+ NUMTODSINTERVAL(" . $a_expr . 
", 'SECOND'), 'yyyy-mm-dd hh24:mi:ss')";
 
  161        return "ROUND((sysdate - to_date('01-JAN-1970','DD-MON-YYYY')) * (86400))";
 
  169        return $a_table . 
"_" . $a_constraint;
 
  195    public function replace($a_table, $a_pk_columns, $a_other_columns)
 
  197        $a_columns = array_merge($a_pk_columns, $a_other_columns);
 
  199        $field_values = array();
 
  200        $placeholders = array();
 
  205        $val_field = array();
 
  208        foreach ($a_columns as $k => $col) {
 
  209            if ($col[0] == 
'clob' or $col[0] == 
'blob') {
 
  210                $val_field[] = $this->
quote($col[1], 
'text') . 
" " . $k;
 
  212                $val_field[] = $this->
quote($col[1], $col[0]) . 
" " . $k;
 
  215            $placeholders[] = 
"%s";
 
  216            $placeholders2[] = 
":$k";
 
  220            if ($col[0] == 
'integer' && !is_null($col[1])) {
 
  221                $col[1] = (int) $col[1];
 
  225            $field_values[$k] = $col[1];
 
  226            if ($col[0] == 
"blob" || $col[0] == 
"clob") {
 
  236        foreach ($a_pk_columns as $k => $col) {
 
  237            $abpk[] = 
"a." . $k . 
" = b." . $k;
 
  238            $delwhere[] = $k . 
" = " . $this->
quote($col[1], $col[0]);
 
  240        foreach ($a_other_columns as $k => $col) {
 
  241            $aboc[] = 
"a." . $k . 
" = b." . $k;
 
  245                "DELETE FROM " . $a_table . 
" WHERE " .
 
  246                implode($delwhere, 
" AND ")
 
  248            $this->
insert($a_table, $a_columns);
 
  251            $this->
handleError(
$r, 
"replace, delete/insert(" . $a_table . 
")");
 
  253            $q = 
"MERGE INTO " . $a_table . 
" a " .
 
  254                "USING (SELECT " . implode($val_field, 
", ") . 
" " .
 
  255                "FROM DUAL) b ON (" . implode($abpk, 
" AND ") . 
") " .
 
  256                "WHEN MATCHED THEN UPDATE SET " . implode($aboc, 
", ") . 
" " .
 
  257                "WHEN NOT MATCHED THEN INSERT (" . implode($a, 
",") . 
") VALUES (" . implode($b, 
",") . 
")";
 
  270    public function locate($a_needle, $a_string, $a_start_pos = 1)
 
  272        $locate = 
' INSTR( ';
 
  273        $locate .= (
'SUBSTR(' . $a_string . 
',0,' . self::CLOB_BUFFER_SIZE . 
')');
 
  275        $locate .= $a_needle;
 
  277        $locate .= $a_start_pos;
 
  293    public function like($a_col, 
$a_type, $a_value = 
"?", $case_insensitive = 
true)
 
  296            return parent::like($a_col, 
$a_type, $a_value, $case_insensitive);
 
  299        if (!in_array(
$a_type, array(
"text", 
"clob", 
"blob"))) {
 
  302        if ($a_value == 
"?") {
 
  303            if ($case_insensitive) {
 
  304                return "UPPER(SUBSTR(" . $a_col . 
",0," . self::CLOB_BUFFER_SIZE . 
")) LIKE(UPPER(?))";
 
  306                return "SUBSTR(" . $a_col . 
",0," . self::CLOB_BUFFER_SIZE . 
") LIKE(?)";
 
  309            if ($case_insensitive) {
 
  310                return " UPPER(SUBSTR(" . $a_col . 
",0," . self::CLOB_BUFFER_SIZE . 
")) LIKE(UPPER(" . $this->
quote($a_value, 
'text') . 
"))";
 
  312                return " SUBSTR(" . $a_col . 
",0," . self::CLOB_BUFFER_SIZE . 
") LIKE(" . $this->
quote($a_value, 
'text') . 
")";
 
  323    public function concat(array $a_values, $a_allow_null = 
true)
 
  325        if (count($a_values) <= 2) {
 
  326            return parent::concat($a_values, 
false);
 
  330        foreach ($a_values as $field_info) {
 
  332                $concat_value = parent::concat(
 
  334                        array($concat_value,$concat_type),
 
  335                        array($field_info[0],$field_info[1])),
 
  340                $concat_value = $field_info[0];
 
  341                $concat_type = $field_info[1];
 
  344        return $concat_value;
 
  361    public function in($a_field, $a_values, $negate = 
false, 
$a_type = 
"")
 
  363        if (count($a_values) <= self::LIMIT_EXPRESSIONS_IN_LIST) {
 
  364            return parent::in($a_field, $a_values, $negate, 
$a_type);
 
  368        $concat = $negate ? 
' AND ' : 
' OR ';
 
  376            $spliced = array_splice($a_values, 0, self::LIMIT_EXPRESSIONS_IN_LIST);
 
  377            $in .= parent::in($a_field, $spliced, $negate, 
$a_type);
 
  401        foreach ($a_tables as 
$table) {
 
  402            $lock = 
'LOCK TABLE ';
 
  404            $lock .= (
$table[
'name'] . 
' ');
 
  408                    $lock .= 
' IN SHARE MODE ';
 
  412                    $lock .= 
' IN EXCLUSIVE MODE ';
 
  420        $this->db->beginTransaction();
 
  421        foreach ($locks as $lock) {
 
  422            $this->db->query($lock);
 
  423            $ilLog->write(__METHOD__ . 
': ' . $lock);
 
  448        $query = 
"ALTER TABLE " . $a_table . 
" DROP PRIMARY KEY DROP INDEX";
 
  457        unset($storage_engine);
 
if(php_sapi_name() !='cli') $in
An exception for terminatinating execution or to throw for unit testing.
isError($data, $code=null)
Tell whether a value is a MDB2 error.
& connect($dsn, $options=false)
Create a new MDB2 connection object and connect to the specified database.
concat(array $a_values, $a_allow_null=true)
CONCAT for oracle allows only the concatenation of two values.
setStorageEngine($storage_engine)
initConnection()
Initialize the database connection.
supportsFulltext()
Is fulltext index supported?
dropPrimaryKey($a_table)
Drop a primary key from a table.
constraintName($a_table, $a_constraint)
Constraint names must be "globally" unique in oracle.
locate($a_needle, $a_string, $a_start_pos=1)
Create locate string.
like($a_col, $a_type, $a_value="?", $case_insensitive=true)
Provisional LIKE support for oracle CLOB's Uses SUBSTR to reduce the length.
fromUnixtime($a_expr, $a_to_text=true)
fromUnixtime (makes timestamp out of unix timestamp)
lockTables($a_tables)
Lock table.
dropFulltextIndex($a_table, $a_name)
static getReservedWords()
Get reserved words.
doConnect()
Standard way to connect to db.
unixTimestamp()
Unix timestamp.
replace($a_table, $a_pk_columns, $a_other_columns)
Replace into method.
getDBVersion()
Get DB version.
unlockTables()
Unlock tables.
getPrimaryKeyIdentifier()
Primary key identifier.
in($a_field, $a_values, $negate=false, $a_type="")
Overwritten implementation of $ilDB->in to avoid ORA-01795 (maximum number of expressions in a list i...
const LIMIT_EXPRESSIONS_IN_LIST
manipulate($sql)
Data manipulation.
getDBPort()
Get database port.
handleError($a_res, $a_info="", $a_level="")
Handle MDB2 Errors.
getDBUser()
Get database user.
getDBName()
Get database name.
query($sql, $a_handle_error=true)
Query.
insert($a_table, $a_columns)
Convenient method for standard insert statements, example field array:
raisePearError($a_message, $a_level="")
Raise an error.
getDBPassword()
Get database password.
getDBHost()
Get database host.
quote($a_query, $a_type=null)
Wrapper for quote method.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if($modEnd===false) $module
if(empty($password)) $table
foreach($_POST as $key=> $value) $res