5 include_once (
"./Services/Database/classes/class.ilDB.php");
26 return "pgsql://".$this->getDBUser().
":".$this->
getDBPassword().
"@".
46 "ALL",
"ANALYSE",
"ANALYZE",
"AND",
"ANY",
"ARRAY",
47 "AS",
"ASC",
"ASYMMETRIC",
"AUTHORIZATION",
"BETWEEN",
"BINARY",
"BOTH",
48 "CASE",
"CAST",
"CHECK",
"COLLATE",
"COLUMN",
"CONSTRAINT",
"CREATE",
49 "CROSS",
"CURRENT_DATE",
"CURRENT_ROLE",
"CURRENT_TIME",
"CURRENT_TIMESTAMP",
"CURRENT_USER",
"DEFAULT",
50 "DEFERRABLE",
"DESC",
"DISTINCT",
"DO",
"ELSE",
"END",
"EXCEPT",
51 "FALSE",
"FOR",
"FOREIGN",
"FREEZE",
"FROM",
"FULL",
"GRANT",
52 "GROUP",
"HAVING",
"ILIKE",
"IN",
"INITIALLY",
"INNER",
"INTERSECT",
53 "INTO",
"IS",
"ISNULL",
"JOIN",
"LEADING",
"LEFT",
"LIKE",
54 "LIMIT",
"LOCALTIME",
"LOCALTIMESTAMP",
"NATURAL",
"NEW",
"NOT",
"NOTNULL",
55 "NULL",
"OFF",
"OFFSET",
"OLD",
"ON",
"ONLY",
"OR",
56 "ORDER",
"OUTER",
"OVERLAPS",
"PLACING",
"PRIMARY",
"REFERENCES",
"RETURNING",
57 "RIGHT",
"SELECT",
"SESSION_USER",
"SIMILAR",
"SOME",
"SYMMETRIC",
"TABLE",
58 "THEN",
"TO",
"TRAILING",
"TRUE",
"UNION",
"UNIQUE",
"USER",
59 "USING",
"VERBOSE",
"WHEN",
"WHERE",
"WITH"
84 return $a_table.
"_".$a_constraint;
110 function replace($a_table, $a_pk_columns, $a_other_columns)
112 $a_columns = array_merge($a_pk_columns, $a_other_columns);
114 $field_values = array();
115 $placeholders = array();
120 $val_field = array();
123 foreach ($a_columns as $k => $col)
125 if($col[0] ==
'clob' or $col[0] ==
'blob')
127 $val_field[] = $this->
quote($col[1],
'text').
" ".$k;
131 $val_field[] = $this->
quote($col[1], $col[0]).
" ".$k;
134 $placeholders[] =
"%s";
135 $placeholders2[] =
":$k";
138 $field_values[$k] = $col[1];
139 if ($col[0] ==
"blob" || $col[0] ==
"clob")
150 foreach ($a_pk_columns as $k => $col)
152 $abpk[] =
"a.".$k.
" = b.".$k;
153 $delwhere[] = $k.
" = ".$this->
quote($col[1], $col[0]);
155 foreach ($a_other_columns as $k => $col)
157 $aboc[] =
"a.".$k.
" = b.".$k;
161 $this->
manipulate(
"DELETE FROM ".$a_table.
" WHERE ".
162 implode ($delwhere,
" AND ")
164 $this->
insert($a_table, $a_columns);
167 $this->
handleError($r,
"replace, delete/insert(".$a_table.
")");
197 foreach($a_tables as $table)
199 $lock =
'LOCK TABLE ';
201 $lock .= ($table[
'name'].
' ');
203 switch($table[
'type'])
206 $lock .=
' IN SHARE MODE ';
210 $lock .=
' IN EXCLUSIVE MODE ';
218 $this->db->beginTransaction();
219 foreach($locks as $lock)
221 $this->db->query($lock);
222 $ilLog->write(__METHOD__.
': '.$lock);