Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
Ignore SQL comments in query console
mechanarchyaf053b61fc37
diff --git a/src/routes/api/sql.js b/src/routes/api/sql.jsindex 1c853f3650..f37b6d310a 100644--- a/src/routes/api/sql.js+++ b/src/routes/api/sql.js@@ -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));