5 include_once (
"./Services/Database/classes/MDB2/class.ilDB.php");
26 return $this->db->loadModule($module);
37 return "pgsql://".$this->getDBUser().
":".$this->
getDBPassword().
"@".
57 "ALL",
"ANALYSE",
"ANALYZE",
"AND",
"ANY",
"ARRAY",
58 "AS",
"ASC",
"ASYMMETRIC",
"AUTHORIZATION",
"BETWEEN",
"BINARY",
"BOTH",
59 "CASE",
"CAST",
"CHECK",
"COLLATE",
"COLUMN",
"CONSTRAINT",
"CREATE",
60 "CROSS",
"CURRENT_DATE",
"CURRENT_ROLE",
"CURRENT_TIME",
"CURRENT_TIMESTAMP",
"CURRENT_USER",
"DEFAULT",
61 "DEFERRABLE",
"DESC",
"DISTINCT",
"DO",
"ELSE",
"END",
"EXCEPT",
62 "FALSE",
"FOR",
"FOREIGN",
"FREEZE",
"FROM",
"FULL",
"GRANT",
63 "GROUP",
"HAVING",
"ILIKE",
"IN",
"INITIALLY",
"INNER",
"INTERSECT",
64 "INTO",
"IS",
"ISNULL",
"JOIN",
"LEADING",
"LEFT",
"LIKE",
65 "LIMIT",
"LOCALTIME",
"LOCALTIMESTAMP",
"NATURAL",
"NEW",
"NOT",
"NOTNULL",
66 "NULL",
"OFF",
"OFFSET",
"OLD",
"ON",
"ONLY",
"OR",
67 "ORDER",
"OUTER",
"OVERLAPS",
"PLACING",
"PRIMARY",
"REFERENCES",
"RETURNING",
68 "RIGHT",
"SELECT",
"SESSION_USER",
"SIMILAR",
"SOME",
"SYMMETRIC",
"TABLE",
69 "THEN",
"TO",
"TRAILING",
"TRUE",
"UNION",
"UNIQUE",
"USER",
70 "USING",
"VERBOSE",
"WHEN",
"WHERE",
"WITH" 95 $a_constraint = str_replace($a_table .
'_',
'', $a_constraint);
97 return $a_table .
"_" . $a_constraint;
123 function replace($a_table, $a_pk_columns, $a_other_columns)
125 $a_columns = array_merge($a_pk_columns, $a_other_columns);
127 $field_values =
array();
128 $placeholders =
array();
133 $val_field =
array();
136 foreach ($a_columns as $k => $col)
138 if($col[0] ==
'clob' or $col[0] ==
'blob')
140 $val_field[] = $this->
quote($col[1],
'text').
" ".$k;
144 $val_field[] = $this->
quote($col[1], $col[0]).
" ".$k;
147 $placeholders[] =
"%s";
148 $placeholders2[] =
":$k";
151 $field_values[$k] = $col[1];
152 if ($col[0] ==
"blob" || $col[0] ==
"clob")
163 foreach ($a_pk_columns as $k => $col)
165 $abpk[] =
"a.".$k.
" = b.".$k;
166 $delwhere[] = $k.
" = ".$this->
quote($col[1], $col[0]);
168 foreach ($a_other_columns as $k => $col)
170 $aboc[] =
"a.".$k.
" = b.".$k;
174 $this->
manipulate(
"DELETE FROM ".$a_table.
" WHERE ".
175 implode ($delwhere,
" AND ")
177 $this->
insert($a_table, $a_columns);
180 $this->
handleError(
$r,
"replace, delete/insert(".$a_table.
")");
211 foreach($a_tables as $table)
213 $lock =
'LOCK TABLE ';
215 $lock .= ($table[
'name'].
' ');
217 switch($table[
'type'])
220 $lock .=
' IN SHARE MODE ';
224 $lock .=
' IN EXCLUSIVE MODE ';
232 $this->db->beginTransaction();
233 foreach($locks as $lock)
235 $this->db->query($lock);
236 if ($ilLog instanceof
ilLog) {
237 $ilLog->write(__METHOD__ .
': ' . $lock);
276 public function groupConcat($a_field_name, $a_seperator =
",", $a_order = NULL) {
277 if ($a_order === NULL) {
278 $sql =
"STRING_AGG(" . $a_field_name .
", " . $this->
quote($a_seperator,
"text") .
")";
280 $sql =
"STRING_AGG(" . $a_field_name .
", " . $this->
quote($a_seperator,
"text") .
" ORDER BY " . $a_order .
")";
replace($a_table, $a_pk_columns, $a_other_columns)
Replace into method.
PostreSQL Database Wrapper.
supportsFulltext()
Is fulltext index supported?
static getReservedWords()
Get reserved words.
dropFulltextIndex($a_table, $a_name)
constraintName($a_table, $a_constraint)
Constraint names must be "globally" unique in oracle.
getPrimaryKeyIdentifier()
Primary key identifier.
getDBName()
Get database name.
initConnection()
Initialize the database connection.
quote($a_query, $a_type=null)
Wrapper for quote method.
getDBHost()
Get database host.
handleError($a_res, $a_info="", $a_level="")
Handle MDB2 Errors.
groupConcat($a_field_name, $a_seperator=",", $a_order=NULL)
insert($a_table, $a_columns)
Convenient method for standard insert statements, example field array:
Create styles array
The data for the language used.
manipulate($sql)
Data manipulation.
unlockTables()
Unlock tables.
getDBPassword()
Get database password.
lockTables($a_tables)
Lock table.
setStorageEngine($storage_engine)