Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1174 from gpongelli/pg_fixes

Changed PostgreSQL's getTableColumns.
  • Loading branch information...
commit ae0730b27453dc19279c0f69187dfe559ac8d0d3 2 parents 5c1ef1d + dd5ee04
@LouisLandry LouisLandry authored
View
11 libraries/joomla/database/driver/postgresql.php
@@ -327,7 +327,7 @@ public function getTableColumns($table, $typeOnly = true)
END AS "null",
CASE WHEN pg_catalog.pg_get_expr(adef.adbin, adef.adrelid, true) IS NOT NULL
THEN pg_catalog.pg_get_expr(adef.adbin, adef.adrelid, true)
- END as "default",
+ END as "Default",
CASE WHEN pg_catalog.col_description(a.attrelid, a.attnum) IS NULL
THEN \'\'
ELSE pg_catalog.col_description(a.attrelid, a.attnum)
@@ -361,6 +361,15 @@ public function getTableColumns($table, $typeOnly = true)
}
}
+ /* Change Postgresql's NULL::* type with PHP's null one */
+ foreach ($fields as $field)
+ {
+ if (preg_match("/^NULL::*/", $field->Default))
+ {
+ $field->Default = null;
+ }
+ }
+
return $result;
}
View
8 tests/suites/database/driver/postgresql/JDatabasePostgresqlTest.php
@@ -331,28 +331,28 @@ public function testGetTableColumns()
$id->column_name = 'id';
$id->type = 'integer';
$id->null = 'NO';
- $id->default = 'nextval(\'jos_dbtest_id_seq\'::regclass)';
+ $id->Default = 'nextval(\'jos_dbtest_id_seq\'::regclass)';
$id->comments = '';
$title = new stdClass;
$title->column_name = 'title';
$title->type = 'character varying(50)';
$title->null = 'NO';
- $title->default = null;
+ $title->Default = null;
$title->comments = '';
$start_date = new stdClass;
$start_date->column_name = 'start_date';
$start_date->type = 'timestamp without time zone';
$start_date->null = 'NO';
- $start_date->default = null;
+ $start_date->Default = null;
$start_date->comments = '';
$description = new stdClass;
$description->column_name = 'description';
$description->type = 'text';
$description->null = 'NO';
- $description->default = null;
+ $description->Default = null;
$description->comments = '';
$this->assertThat(
Please sign in to comment.
Something went wrong with that request. Please try again.