mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 17:59:25 +00:00
Fix bug where trailing whitespace in sql query after ; would error
This commit is contained in:
@@ -46,8 +46,10 @@ class DatabaseConnectionPool {
|
||||
* @return {(Array<object>|object)} Data returned from the database
|
||||
*/
|
||||
async runQuery(sql, params) {
|
||||
sql = sql.trim();
|
||||
|
||||
if (sql.slice(-1) !== ';')
|
||||
throw new Error('Invalid query, needs ;');
|
||||
throw new Error('Invalid query, needs trailing ;');
|
||||
|
||||
// Execute as non-prepared if no params are supplied
|
||||
if (typeof params === 'undefined') {
|
||||
|
||||
Reference in New Issue
Block a user