fixed problem when a query raised a database error

This commit is contained in:
javi 2014-06-30 19:55:47 +02:00
parent ac0826dc91
commit 9ab3567725

View File

@ -381,7 +381,10 @@ function handleQuery(req, res) {
//TODO: sanitize cdbuser
console.log("SELECT CDB_QueryTables($quotesql$" + sql + "$quotesql$");
pg.query("SELECT CDB_QueryTables($quotesql$" + sql + "$quotesql$)", function (err, result) {
if (err) throw err;
if (err) {
self(err);
return;
}
if ( result.rowCount === 1 ) {
var raw_tables = result.rows[0].cdb_querytables;
var tables = raw_tables.split(/^\{(.*)\}$/)[1].split(',');