5 include_once(
"./Services/Database/classes/MDB2/class.ilDB.php");
27 return $this->db->loadModule(
$module);
58 "ALL",
"ANALYSE",
"ANALYZE",
"AND",
"ANY",
"ARRAY",
59 "AS",
"ASC",
"ASYMMETRIC",
"AUTHORIZATION",
"BETWEEN",
"BINARY",
"BOTH",
60 "CASE",
"CAST",
"CHECK",
"COLLATE",
"COLUMN",
"CONSTRAINT",
"CREATE",
61 "CROSS",
"CURRENT_DATE",
"CURRENT_ROLE",
"CURRENT_TIME",
"CURRENT_TIMESTAMP",
"CURRENT_USER",
"DEFAULT",
62 "DEFERRABLE",
"DESC",
"DISTINCT",
"DO",
"ELSE",
"END",
"EXCEPT",
63 "FALSE",
"FOR",
"FOREIGN",
"FREEZE",
"FROM",
"FULL",
"GRANT",
64 "GROUP",
"HAVING",
"ILIKE",
"IN",
"INITIALLY",
"INNER",
"INTERSECT",
65 "INTO",
"IS",
"ISNULL",
"JOIN",
"LEADING",
"LEFT",
"LIKE",
66 "LIMIT",
"LOCALTIME",
"LOCALTIMESTAMP",
"NATURAL",
"NEW",
"NOT",
"NOTNULL",
67 "NULL",
"OFF",
"OFFSET",
"OLD",
"ON",
"ONLY",
"OR",
68 "ORDER",
"OUTER",
"OVERLAPS",
"PLACING",
"PRIMARY",
"REFERENCES",
"RETURNING",
69 "RIGHT",
"SELECT",
"SESSION_USER",
"SIMILAR",
"SOME",
"SYMMETRIC",
"TABLE",
70 "THEN",
"TO",
"TRAILING",
"TRUE",
"UNION",
"UNIQUE",
"USER",
71 "USING",
"VERBOSE",
"WHEN",
"WHERE",
"WITH" 96 $a_constraint = str_replace($a_table .
'_',
'', $a_constraint);
98 return $a_table .
"_" . $a_constraint;
124 public function replace($a_table, $a_pk_columns, $a_other_columns)
126 $a_columns = array_merge($a_pk_columns, $a_other_columns);
128 $field_values =
array();
129 $placeholders =
array();
134 $val_field =
array();
137 foreach ($a_columns as $k => $col) {
138 if ($col[0] ==
'clob' or $col[0] ==
'blob') {
139 $val_field[] = $this->
quote($col[1],
'text') .
" " . $k;
141 $val_field[] = $this->
quote($col[1], $col[0]) .
" " . $k;
144 $placeholders[] =
"%s";
145 $placeholders2[] =
":$k";
148 $field_values[$k] = $col[1];
149 if ($col[0] ==
"blob" || $col[0] ==
"clob") {
159 foreach ($a_pk_columns as $k => $col) {
160 $abpk[] =
"a." . $k .
" = b." . $k;
161 $delwhere[] = $k .
" = " . $this->
quote($col[1], $col[0]);
163 foreach ($a_other_columns as $k => $col) {
164 $aboc[] =
"a." . $k .
" = b." . $k;
169 "DELETE FROM " . $a_table .
" WHERE " .
170 implode($delwhere,
" AND ")
172 $this->
insert($a_table, $a_columns);
175 $this->
handleError(
$r,
"replace, delete/insert(" . $a_table .
")");
206 foreach ($a_tables as
$table) {
207 $lock =
'LOCK TABLE ';
209 $lock .= ($table[
'name'] .
' ');
211 switch ($table[
'type']) {
213 $lock .=
' IN SHARE MODE ';
217 $lock .=
' IN EXCLUSIVE MODE ';
225 $this->db->beginTransaction();
226 foreach ($locks as $lock) {
227 $this->db->query($lock);
228 if ($ilLog instanceof
ilLog) {
229 $ilLog->write(__METHOD__ .
': ' . $lock);
271 public function groupConcat($a_field_name, $a_seperator =
",", $a_order = null)
273 if ($a_order === null) {
274 $sql =
"STRING_AGG(" . $a_field_name .
", " . $this->
quote($a_seperator,
"text") .
")";
276 $sql =
"STRING_AGG(" . $a_field_name .
", " . $this->
quote($a_seperator,
"text") .
" ORDER BY " . $a_order .
")";
289 public function locate($a_needle, $a_string, $a_start_pos = 1) :
string 291 $manager = $this->db->loadModule(
'Manager');
292 return $manager->getQueryUtils()->locate($a_needle, $a_string, $a_start_pos);
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.
if($modEnd===false) $module
groupConcat($a_field_name, $a_seperator=",", $a_order=null)
getDBName()
Get database name.
initConnection()
Initialize the database connection.
quote($a_query, $a_type=null)
Wrapper for quote method.
getDBHost()
Get database host.
getDBUser()
Get database user.
locate($a_needle, $a_string, $a_start_pos=1)
handleError($a_res, $a_info="", $a_level="")
Handle MDB2 Errors.
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.
if(empty($password)) $table
lockTables($a_tables)
Lock table.
setStorageEngine($storage_engine)