Class ilDBPdoReverse.
More...
◆ getTableConstraintDefinition()
ilDBPdoReversePostgres::getTableConstraintDefinition |
( |
|
$table, |
|
|
|
$constraint_name |
|
) |
| |
Get the structure of a constraint into an array.
- Parameters
-
string | $table | name of table that should be used in method |
string | $constraint_name | name of constraint that should be used in method |
- Returns
- mixed data array on success, a MDB2 error on failure public
Implements ilDBReverse.
Definition at line 186 of file class.ilDBPdoReversePostgres.php.
References $columns, ilDBPdoReverse\$db_instance, $query, $row, array, ilDBConstants\FETCHMODE_ASSOC, and ilDBConstants\MODULE_MANAGER.
189 $query =
'SELECT relname, indisunique, indisprimary, indkey FROM pg_index, pg_class';
190 $query .=
' WHERE pg_class.oid = pg_index.indexrelid';
191 $query .=
" AND (indisunique = 't' OR indisprimary = 't')";
192 $query .=
' AND pg_class.relname = %s';
193 $constraint_name_mdb2 = $db->getIndexName($constraint_name);
199 if ($e instanceof PDOException || empty(
$row)) {
208 $row = array_change_key_case(
$row, CASE_LOWER);
211 $definition =
array();
212 if (
$row[
'indisprimary'] ==
't') {
213 $definition[
'primary'] =
true;
214 } elseif (
$row[
'indisunique'] ==
't') {
215 $definition[
'unique'] =
true;
218 $index_column_numbers = explode(
' ',
$row[
'indkey']);
221 foreach ($index_column_numbers as $number) {
223 'position' => $colpos ++,
224 'sorting' =>
'ascending',
Class ilDatabaseException.
Create styles array
The data for the language used.
◆ getTriggerDefinition()
ilDBPdoReversePostgres::getTriggerDefinition |
( |
|
$trigger | ) |
|
Get the structure of a trigger into an array.
EXPERIMENTAL
WARNING: this function is experimental and may change the returned value at any time until labelled as non-experimental
- Parameters
-
string | $trigger | name of trigger that should be used in method |
- Returns
- mixed data array on success, a MDB2 error on failure public
: add support for plsql functions and functions with args
Implements ilDBReverse.
Definition at line 248 of file class.ilDBPdoReversePostgres.php.
References ilDBPdoReverse\$db_instance, $query, array, and MDB2_FETCHMODE_ASSOC.
251 $query =
"SELECT trg.tgname AS trigger_name, 252 tbl.relname AS table_name, 254 WHEN p.proname IS NOT NULL THEN 'EXECUTE PROCEDURE ' || p.proname || '();' 257 CASE trg.tgtype & cast(2 as int2) 261 CASE trg.tgtype & cast(28 as int2) 262 WHEN 16 THEN 'UPDATE' 265 WHEN 20 THEN 'INSERT, UPDATE' 266 WHEN 28 THEN 'INSERT, UPDATE, DELETE' 267 WHEN 24 THEN 'UPDATE, DELETE' 268 WHEN 12 THEN 'INSERT, DELETE' 269 END AS trigger_event, 270 trg.tgenabled AS trigger_enabled, 271 obj_description(trg.oid, 'pg_trigger') AS trigger_comment 275 WHERE trg.tgrelid = tbl.oid 276 AND trg.tgfoid = p.oid 277 AND trg.tgname = " . $db->quote($trigger,
'text');
279 'trigger_name' =>
'text',
280 'table_name' =>
'text',
281 'trigger_body' =>
'text',
282 'trigger_type' =>
'text',
283 'trigger_event' =>
'text',
284 'trigger_comment' =>
'text',
285 'trigger_enabled' =>
'boolean',
const MDB2_FETCHMODE_ASSOC
Column data indexed by column names.
Create styles array
The data for the language used.
◆ tableInfo()
ilDBPdoReversePostgres::tableInfo |
( |
|
$result, |
|
|
|
$mode = null |
|
) |
| |
Returns information about a table or a result set.
NOTE: only supports 'table' and 'flags' if $result is a table name.
- Parameters
-
object | string | $result | MDB2_result object from a query or a string containing the name of a table. While this also accepts a query result resource identifier, this behavior is deprecated. |
int | $mode | a valid tableInfo mode |
- Returns
- array an associative array with the information requested. A MDB2_Error object on failure.
- See also
- MDB2_Driver_Common::tableInfo()
Implements ilDBReverse.
Definition at line 312 of file class.ilDBPdoReversePostgres.php.
References ilDBPdoReverse\$db_instance, $res, $result, array, PEAR\isError(), MDB2\isResultCommon(), MDB2_ERROR_NEED_MORE_DATA, MDB2_TABLEINFO_ORDER, and MDB2_TABLEINFO_ORDERTABLE.
314 return parent::tableInfo(
$result, $mode);
320 if (!is_resource($resource)) {
324 if ($db->options[
'portability']) {
325 if ($db->options[
'field_case'] == CASE_LOWER) {
326 $case_func =
'strtolower';
328 $case_func =
'strtoupper';
331 $case_func =
'strval';
334 $count = @pg_num_fields($resource);
338 $res[
'num_fields'] = $count;
341 $db->loadModule(
'Datatype', null,
true);
342 for ($i = 0; $i < $count; $i ++) {
344 'table' => function_exists(
'pg_field_table') ? @pg_field_table($resource, $i) :
'',
345 'name' => $case_func(@pg_field_name($resource, $i)),
346 'type' => @pg_field_type($resource, $i),
347 'length' => @pg_field_size($resource, $i),
350 $mdb2type_info = $db->datatype->mapNativeDatatype(
$res[$i]);
352 return $mdb2type_info;
354 $res[$i][
'mdb2type'] = $mdb2type_info[0][0];
356 $res[
'order'][
$res[$i][
'name']] = $i;
359 $res[
'ordertable'][
$res[$i][
'table']][
$res[$i][
'name']] = $i;
const MDB2_ERROR_NEED_MORE_DATA
const MDB2_TABLEINFO_ORDERTABLE
isResultCommon($value)
Tell whether a value is a MDB2 result implementing the common interface.
Create styles array
The data for the language used.
const MDB2_TABLEINFO_ORDER
These are constants for the tableInfo-function they are bitwised or'ed.
isError($data, $code=null)
Tell whether a value is a PEAR error.
The documentation for this class was generated from the following file: