5include_once (
"./Services/Database/classes/class.ilDB.php");
 
   31                if(!isset(
$GLOBALS[
'_MDB2_dsninfo_default'][
'charset']) or              
 
   32                        $GLOBALS[
'_MDB2_dsninfo_default'][
'charset'] != 
'utf8')
 
   34                        $GLOBALS[
'_MDB2_dsninfo_default'][
'charset'] = 
'utf8'; 
 
   37                return array(
'phptype' => 
'oci8',
 
   59                $query = 
'SELECT * FROM v$version';
 
   64                        return parent::getDBVersion();
 
   67                return isset(
$row[
'banner']) ? 
$row[
'banner'] : parent::getDBVersion();
 
   78                        "ACCESS", 
"ADD", 
"ALL", 
"ALTER", 
"AND", 
"ANY", 
"AS", 
"ASC",
 
   79                        "AUDIT", 
"BETWEEN", 
"BY", 
"CHAR", 
"CHECK", 
"CLUSTER", 
"COLUMN",
 
   80                        "COMMENT", 
"COMPRESS", 
"CONNECT", 
"CREATE", 
"CURRENT", 
"DATE",
 
   81                        "DECIMAL", 
"DEFAULT", 
"DELETE", 
"DESC", 
"DISTINCT", 
"DROP", 
"ELSE",
 
   82                        "EXCLUSIVE", 
"EXISTS", 
"FILE", 
"FLOAT", 
"FOR", 
"FROM", 
"GRANT", 
"GROUP",
 
   83                        "HAVING", 
"IDENTIFIED", 
"IMMEDIATE", 
"IN", 
"INCREMENT", 
"INDEX", 
"INITIAL",
 
   84                        "INSERT", 
"INTEGER", 
"INTERSECT", 
"INTO", 
"IS", 
"LEVEL", 
"LIKE", 
"LOCK", 
"LONG",
 
   85                        "MAXEXTENTS", 
"MINUS", 
"MLSLABEL", 
"MODE", 
"MODIFY", 
"NOAUDIT", 
"NOCOMPRESS", 
"NOT",
 
   86                        "NOWAIT", 
"NULL", 
"NUMBER", 
"OF", 
"OFFLINE", 
"ON", 
"ONLINE",
"OPTION",
 
   87                        "OR", 
"ORDER", 
"PCTFREE", 
"PRIOR", 
"PRIVILEGES", 
"PUBLIC", 
"RAW", 
"RENAME",
 
   88                        "RESOURCE", 
"REVOKE", 
"ROW", 
"ROWID", 
"ROWNUM", 
"ROWS", 
"SELECT", 
"SESSION", 
"SET",
 
   89                        "SHARE", 
"SIZE", 
"SMALLINT", 
"START", 
"SUCCESSFUL", 
"SYNONYM", 
"SYSDATE",
"TABLE",
 
   90                        "THEN", 
"TO", 
"TRIGGER", 
"UID", 
"UNION", 
"UNIQUE", 
"UPDATE", 
"USER",
"VALIDATE",
 
   91                        "VALUES", 
"VARCHAR", 
"VARCHAR2", 
"VIEW", 
"WHENEVER", 
"WHERE", 
"WITH" 
  101                        array(
"use_transactions" => 
true));
 
  109                $GLOBALS[
'_MDB2_dsninfo_default'][
'charset'] = 
'utf8';
 
  110                $this->
query(
"ALTER SESSION SET nls_length_semantics='CHAR'");
 
  111                $this->
query(
"ALTER SESSION SET NLS_SORT = binary_ci");
 
  131                return "LOCALTIMESTAMP";
 
  141                        return "TO_DATE('19700101000000','YYYYMMDDHH24MISS') ".
 
  142                                "+ NUMTODSINTERVAL(".$a_expr.
", 'SECOND')";
 
  146                        return "to_char(TO_DATE('19700101000000','YYYYMMDDHH24MISS') ".
 
  147                                "+ NUMTODSINTERVAL(".$a_expr.
", 'SECOND'), 'yyyy-mm-dd hh24:mi:ss')";
 
  158                return "ROUND((sysdate - to_date('01-JAN-1970','DD-MON-YYYY')) * (86400))";
 
  166                return $a_table.
"_".$a_constraint;
 
  192        function replace($a_table, $a_pk_columns, $a_other_columns)
 
  194                $a_columns = array_merge($a_pk_columns, $a_other_columns);
 
  196                $field_values = array();
 
  197                $placeholders = array();
 
  202                $val_field = array();
 
  205                foreach ($a_columns as $k => $col)
 
  207                        if($col[0] == 
'clob' or $col[0] == 
'blob')
 
  209                                $val_field[] = $this->
quote($col[1], 
'text').
" ".$k;
 
  213                                $val_field[] = $this->
quote($col[1], $col[0]).
" ".$k;
 
  216                        $placeholders[] = 
"%s";
 
  217                        $placeholders2[] = 
":$k";
 
  221                        if ($col[0] == 
'integer' && !is_null($col[1]))
 
  223                                $col[1] = (int) $col[1];
 
  227                        $field_values[$k] = $col[1];
 
  228                        if ($col[0] == 
"blob" || $col[0] == 
"clob")
 
  239                foreach ($a_pk_columns as $k => $col)
 
  241                        $abpk[] = 
"a.".$k.
" = b.".$k;
 
  242                        $delwhere[] = $k.
" = ".$this->
quote($col[1], $col[0]);
 
  244                foreach ($a_other_columns as $k => $col)
 
  246                        $aboc[] = 
"a.".$k.
" = b.".$k;
 
  250                        $this->
manipulate(
"DELETE FROM ".$a_table.
" WHERE ".
 
  251                                implode ($delwhere, 
" AND ")
 
  253                        $this->
insert($a_table, $a_columns);
 
  256                        $this->
handleError($r, 
"replace, delete/insert(".$a_table.
")");
 
  260                        $q = 
"MERGE INTO ".$a_table.
" a ".
 
  261                                "USING (SELECT ".implode($val_field, 
", ").
" ".
 
  262                                "FROM DUAL) b ON (".implode($abpk, 
" AND ").
") ".
 
  263                                "WHEN MATCHED THEN UPDATE SET ".implode($aboc, 
", ").
" ".
 
  264                                "WHEN NOT MATCHED THEN INSERT (".implode($a, 
",").
") VALUES (".implode($b, 
",").
")";
 
  277        public function locate($a_needle,$a_string,$a_start_pos = 1)
 
  279                $locate = 
' INSTR( ';
 
  280                $locate .= (
'SUBSTR('.$a_string.
',0,'.self::CLOB_BUFFER_SIZE.
')');
 
  282                $locate .= $a_needle;
 
  284                $locate .= $a_start_pos;
 
  300        public function like($a_col, $a_type, $a_value = 
"?", $case_insensitive = 
true)
 
  302                if($a_type == 
'text')
 
  304                        return parent::like($a_col,$a_type,$a_value,$case_insensitive);
 
  307                if (!in_array($a_type, array(
"text", 
"clob", 
"blob")))
 
  309                        $this->
raisePearError(
"Like: Invalid column type '".$a_type.
"'.", $this->error_class->FATAL);
 
  313                        if ($case_insensitive)
 
  315                                return "UPPER(SUBSTR(".$a_col.
",0,".self::CLOB_BUFFER_SIZE.
")) LIKE(UPPER(?))";
 
  319                                return "SUBSTR(".$a_col .
",0,".self::CLOB_BUFFER_SIZE.
") LIKE(?)";
 
  324                        if ($case_insensitive)
 
  326                                return " UPPER(SUBSTR(".$a_col.
",0,".self::CLOB_BUFFER_SIZE.
")) LIKE(UPPER(".$this->
quote($a_value, 
'text').
"))";
 
  330                                return " SUBSTR(".$a_col.
",0,".self::CLOB_BUFFER_SIZE.
") LIKE(".$this->
quote($a_value, 
'text').
")";
 
  341        public function concat($a_values, $a_allow_null = 
true)
 
  343                if(count($a_values) <= 2)
 
  345                        return parent::concat($a_values,
false);
 
  349                foreach($a_values as $field_info)
 
  353                                $concat_value = parent::concat(
 
  355                                                array($concat_value,$concat_type),
 
  356                                                array($field_info[0],$field_info[1])),
 
  363                                $concat_value = $field_info[0];
 
  364                                $concat_type = $field_info[1];
 
  367                return $concat_value;
 
  384        function in($a_field, $a_values, $negate = 
false, $a_type = 
"")
 
  386                if(count($a_values) <= self::LIMIT_EXPRESSIONS_IN_LIST)
 
  388                        return parent::in($a_field,$a_values,$negate,$a_type);
 
  392                $concat = $negate ? 
' AND ' : 
' OR ';
 
  403                        $spliced = array_splice($a_values, 0, self::LIMIT_EXPRESSIONS_IN_LIST);
 
  404                        $in .= parent::in($a_field, $spliced, $negate, $a_type);
 
  429                foreach($a_tables as $table)
 
  431                        $lock = 
'LOCK TABLE ';
 
  433                        $lock .= ($table[
'name'].
' ');
 
  435                        switch($table[
'type'])
 
  438                                        $lock .= 
' IN SHARE MODE ';
 
  442                                        $lock .= 
' IN EXCLUSIVE MODE ';
 
  450                $this->db->beginTransaction();
 
  451                foreach($locks as $lock)
 
  453                        $this->db->query($lock);
 
  454                        $ilLog->write(__METHOD__.
': '.$lock);
 
  478                $query = 
"ALTER TABLE ".$a_table.
" DROP PRIMARY KEY DROP INDEX";
 
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($a_values, $a_allow_null=true)
CONCAT for oracle allows only the concatenation of two values.
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.
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.