summaryrefslogtreecommitdiff
path: root/lib/pgsqlschema.php
diff options
context:
space:
mode:
authorBrenda Wallace <shiny@cpan.org>2010-03-10 21:25:44 +1300
committerBrenda Wallace <shiny@cpan.org>2010-03-10 21:25:44 +1300
commitc4ee2b20bee567e1c41888bb46bfc8d5f98e8951 (patch)
treec8d649aa70dcf449fb88d21ab76a9c6a5b937095 /lib/pgsqlschema.php
parent47034553fea0ad760596eae416a675b93dd9380c (diff)
throw an error that looks like mysql errors.. :-S
Diffstat (limited to 'lib/pgsqlschema.php')
-rw-r--r--lib/pgsqlschema.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/pgsqlschema.php b/lib/pgsqlschema.php
index 91bc09667..a4ebafae4 100644
--- a/lib/pgsqlschema.php
+++ b/lib/pgsqlschema.php
@@ -1,3 +1,4 @@
+
<?php
/**
* StatusNet, the distributed open-source microblogging tool
@@ -61,7 +62,8 @@ class PgsqlSchema extends Schema
public function getTableDef($name)
{
- $res = $this->conn->query("select *, column_default as default, is_nullable as Null, udt_name as Type, column_name AS Field from INFORMATION_SCHEMA.COLUMNS where table_name = '$name'");
+ $res = $this->conn->query("SELECT *, column_default as default, is_nullable as Null,
+ udt_name as Type, column_name AS Field from INFORMATION_SCHEMA.COLUMNS where table_name = '$name'");
if (PEAR::isError($res)) {
throw new Exception($res->getMessage());
@@ -72,6 +74,9 @@ class PgsqlSchema extends Schema
$td->name = $name;
$td->columns = array();
+ if ($res->numRows() == 0 ) {
+ throw new Exception('no such table'); //pretend to be the msyql error. yeah, this sucks.
+ }
$row = array();
while ($res->fetchInto($row, DB_FETCHMODE_ASSOC)) {
@@ -359,6 +364,7 @@ class PgsqlSchema extends Schema
try {
$td = $this->getTableDef($tableName);
+
} catch (Exception $e) {
if (preg_match('/no such table/', $e->getMessage())) {
return $this->createTable($tableName, $columns);