Line 24 | Line 24 |
---|
* * @return array */
|
* * @return array */
|
public static function get_dbms_type_map()
| static public function get_dbms_type_map()
|
{ return array( 'postgres' => array(
| { return array( 'postgres' => array(
|
Line 94 | Line 94 |
---|
$this->db->sql_freeresult($result);
return $tables;
|
$this->db->sql_freeresult($result);
return $tables;
|
| }
/** * {@inheritDoc} */ function sql_table_exists($table_name) { $sql = "SELECT CAST(EXISTS( SELECT * FROM information_schema.tables WHERE table_schema = 'public' AND table_name = '" . $this->db->sql_escape($table_name) . "' ) AS INTEGER)"; $result = $this->db->sql_query_limit($sql, 1); $row = $this->db->sql_fetchrow($result); $table_exists = (booL) $row['exists']; $this->db->sql_freeresult($result);
return $table_exists;
|
}
/**
| }
/**
|
Line 129 | Line 147 |
---|
if (isset($prepared_column['auto_increment']) && $prepared_column['auto_increment'] && strlen($column_name) > 26) // "${column_name}_gen" {
|
if (isset($prepared_column['auto_increment']) && $prepared_column['auto_increment'] && strlen($column_name) > 26) // "${column_name}_gen" {
|
trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum auto increment column length is 26 characters.", E_USER_ERROR);
| trigger_error("Index name '{$column_name}_gen' on table '$table_name' is too long. The maximum auto increment column length is 26 characters.", E_USER_ERROR);
|
}
// here we add the definition of the new column to the list of columns
| }
// here we add the definition of the new column to the list of columns
|
Line 559 | Line 577 |
---|
// we don't want to double up on constraints if we change different number data types if (isset($column_data['constraint'])) {
|
// we don't want to double up on constraints if we change different number data types if (isset($column_data['constraint'])) {
|
$constraint_sql = "SELECT consrc as constraint_data FROM pg_constraint, pg_class bc
| $constraint_sql = "SELECT pg_get_constraintdef(pc.oid) AS constraint_data FROM pg_constraint pc, pg_class bc
|
WHERE conrelid = bc.oid
|
WHERE conrelid = bc.oid
|
AND bc.relname = '{$table_name}'
| AND bc.relname = '" . $this->db->sql_escape($table_name) . "'
|
AND NOT EXISTS ( SELECT *
|
AND NOT EXISTS ( SELECT *
|
FROM pg_constraint as c, pg_inherits as i WHERE i.inhrelid = pg_constraint.conrelid AND c.conname = pg_constraint.conname AND c.consrc = pg_constraint.consrc
| FROM pg_constraint AS c, pg_inherits AS i WHERE i.inhrelid = pc.conrelid AND c.conname = pc.conname AND pg_get_constraintdef(c.oid) = pg_get_constraintdef(pc.oid)
|
AND c.conrelid = i.inhparent )";
| AND c.conrelid = i.inhparent )";
|