Changeset:
3e4c500f792c
https://sourceforge.net/p/mrbs/hg-code/ci/3e4c500f792ce69e4dc0c77cbee4ae0686a6ae52
Author:
Campbell Morrison <[email protected]>
Date:
Wed Oct 12 09:11:27 2016 +0100
Log message:
Added some error checking to DB_pgsql::table_exists().
diffstat:
web/lib/MRBS/DB_pgsql.php | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diffs (31 lines):
diff -r fe0d186d752f -r 3e4c500f792c web/lib/MRBS/DB_pgsql.php
--- a/web/lib/MRBS/DB_pgsql.php Tue Oct 11 17:05:24 2016 +0100
+++ b/web/lib/MRBS/DB_pgsql.php Wed Oct 12 09:11:27 2016 +0100
@@ -147,8 +147,25 @@
}
$res = $this->query1($sql, $sql_params);
-
- return ($res <= 0) ? FALSE : TRUE;
+
+ if ($res == 0)
+ {
+ return false;
+ }
+ elseif ($res == 1)
+ {
+ return true;
+ }
+ elseif (($res > 1) && !isset($table_parts['table_schema']))
+ {
+ $message = "More than one table called '$table'. You need to set " .
'$db_schema in the config file.';
+ throw new DBException($message);
+ }
+ else
+ {
+ $message = "Unexpected result from SELECT COUNT(*) query.";
+ throw new DBException($message);
+ }
}
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits