throw on empty statement

This commit is contained in:
Mikaël Francoeur
2025-07-14 14:15:12 -04:00
parent e25064959b
commit 093140d84c
2 changed files with 5 additions and 12 deletions

View File

@@ -77,6 +77,10 @@ class Database {
* @param {string} sql - The SQL statement string to prepare.
*/
prepare(sql) {
if (!sql) {
throw new RangeError('The supplied SQL string contains no statements');
}
try {
return new Statement(this.db.prepare(sql), this);
} catch (err) {