diff --git a/src/routes/api/sql.js b/src/routes/api/sql.js index 1c853f365..9dec60aff 100644 --- a/src/routes/api/sql.js +++ b/src/routes/api/sql.js @@ -33,6 +33,12 @@ function execute(req) { for (let query of queries) { query = query.trim(); + while (query.startsWith('-- ') { + // Query starts with one or more SQL comments, discard these before we execute. + const pivot = query.indexOf('\n'); + query = pivot > 0 ? query.substr(pivot + 1).trim() : ""; + } + if (!query) { continue; }