Ignore SQL comments in query console

This commit is contained in:
mechanarchy 2023-06-17 17:06:17 +10:00 committed by GitHub
parent 6f16b4caec
commit af053b61fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,6 +36,11 @@ function execute(req) {
if (!query) {
continue;
}
while (query.startsWith('-- ') {
// Query starts with one or more SQL comments, discard these before we execute.
query = query.substr(query.indexOf('\n') + 1)
}
if (query.toLowerCase().startsWith('select') || query.toLowerCase().startsWith('with')) {
results.push(sql.getRows(query));