sqlite3
sqlite3 copied to clipboard
SQLITE_ENABLE_UPDATE_DELETE_LIMIT does not work on Linux
I was testing the same project on Windows and Linux found the Linux version of this module does not support some syntax:
// deno run --allow-all --unstable test.ts
import { Database } from 'https://deno.land/x/[email protected]/mod.ts'
const db = new Database(':memory:')
db.run(`
CREATE TABLE test (
id INTEGER PRIMARY KEY AUTOINCREMENT
)
`)
db.run(`
DELETE FROM test
ORDER BY id
LIMIT 1
`)
// error: Uncaught (in promise) Error: near "ORDER": syntax error
// throw new Error(err);
// ^
// at Database.exec (https://deno.land/x/[email protected]/src/database.ts:314:15)
// at Database.run (https://deno.land/x/[email protected]/src/database.ts:326:17)
So I checked the compile options and found that it was enabled: https://github.com/denodrivers/sqlite3/blob/dc9cbf277783e2af52067136c0af2445e7ad2735/scripts/build.ts#L23
I tried enabling it using --enable-update-limit on configure (unix specific) instead of passing -D SQLITE_ENABLE_UPDATE_DELETE_LIMIT, while it seems to enable that but it causes some weird segmentation fault in another random place. I'll have to investigate more... for Windows on the other hand, it seems enough to just pass the latter.
Nevermind, it was a silly issue. Using --enable-update-limit does make it work on unix systems too. I'll publish a new release soon.