Closed MigFerreira closed 11 months ago
Have the following base query to drop table:
async drop () { return DB.sql`DROP TABLE IF EXISTS ${this.tableName}`; };
which is creating following console error:
Error: sqlite3 result code 1: near "?": syntax error SQLite3Error http://127.0.0.1:5173/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs?v=83ec1d7f:5714 toss3 http://127.0.0.1:5173/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs?v=83ec1d7f:10398 checkSqlite3Rc http://127.0.0.1:5173/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs?v=83ec1d7f:10417 checkRc http://127.0.0.1:5173/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs?v=83ec1d7f:10712 exec http://127.0.0.1:5173/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs?v=83ec1d7f:10842 execQuery http://127.0.0.1:5173/node_modules/sqlocal/dist/worker.mjs?type=module&worker_file:47 flushQueue http://127.0.0.1:5173/node_modules/sqlocal/dist/worker.mjs?type=module&worker_file:92 init http://127.0.0.1:5173/node_modules/sqlocal/dist/worker.mjs?type=module&worker_file:124
checked the worker when db.exec is executed and confirmed the object is:
method: "all" params: Array [ "Accounts" ] queryKey: "snTm0m_khR34swnpiudaC" sql: "DROP TABLE IF EXISTS ?" type: "query"
Seems to be an issue with binding arguments to query. If I directly replace variable with text the query works fine.
This is a restriction imposed by SQLite. You cannot parametrize a table or column name, per the SQLite documentation.
Have the following base query to drop table:
which is creating following console error:
checked the worker when db.exec is executed and confirmed the object is:
Seems to be an issue with binding arguments to query. If I directly replace variable with text the query works fine.