summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2013-01-25 09:00:58 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2013-01-25 09:09:36 +0100
commit3b907b85a51d489a6a752da80aaddcd854d9e878 (patch)
tree77fee7e41fa9199b55840731caee78c39d375eda
parentba06ed39d6b5c9d7ba38456783e67c888f3b3cf6 (diff)
downloadsqltutor-plugin-3b907b85a51d489a6a752da80aaddcd854d9e878.tar.gz
sqltutor-plugin-3b907b85a51d489a6a752da80aaddcd854d9e878.tar.bz2
sqltutor-plugin-3b907b85a51d489a6a752da80aaddcd854d9e878.zip
Use print_error function for query error display
-rw-r--r--sqlbox/lang/en/sqlbox.php1
-rw-r--r--sqlbox/locallib.php4
-rw-r--r--sqlbox/version.php2
3 files changed, 5 insertions, 2 deletions
diff --git a/sqlbox/lang/en/sqlbox.php b/sqlbox/lang/en/sqlbox.php
index 9da813a..8867d10 100644
--- a/sqlbox/lang/en/sqlbox.php
+++ b/sqlbox/lang/en/sqlbox.php
@@ -42,3 +42,4 @@ $string['sqlbox:readqueries'] = 'Read queries done by users';
$string['pluginadministration'] = 'sqlbox administration';
$string['pluginname'] = 'sqlbox';
$string['viewresults'] = 'View Results';
+$string['queryfailed'] = 'Query failed: {$a}';
diff --git a/sqlbox/locallib.php b/sqlbox/locallib.php
index 3916d34..359d5ae 100644
--- a/sqlbox/locallib.php
+++ b/sqlbox/locallib.php
@@ -40,10 +40,12 @@ defined('MOODLE_INTERNAL') || die();
//}
function db_table_from_query($db, $query) {
+ global $PAGE;
+
$table = new html_table;
$result = @pg_query($db, $query);
if (!$result)
- error("Query failed: ".pg_last_error($db));
+ print_error('queryfailed', 'sqlbox', $PAGE->url, pg_last_error($db));
$table = new html_table;
$n = pg_num_fields($result);
diff --git a/sqlbox/version.php b/sqlbox/version.php
index 1222e09..82e4d06 100644
--- a/sqlbox/version.php
+++ b/sqlbox/version.php
@@ -30,7 +30,7 @@
defined('MOODLE_INTERNAL') || die();
-$module->version = 2013012500; // The current module version (Date: YYYYMMDDXX)
+$module->version = 2013012501; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2010031900; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)
$module->component = 'mod_sqlbox'; // To check on upgrade, that module sits in correct place