denodrivers / sqlite3

The fastest and correct SQLite3 module for Deno runtime
https://jsr.io/@db/sqlite
Apache License 2.0
268 stars 22 forks source link

SQLITE_ENABLE_UPDATE_DELETE_LIMIT does not work on Linux #118

Closed BlackGlory closed 2 months ago

BlackGlory commented 10 months ago

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/sqlite3@0.10.0/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/sqlite3@0.10.0/src/database.ts:314:15)
//     at Database.run (https://deno.land/x/sqlite3@0.10.0/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

DjDeveloperr commented 8 months ago

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.

DjDeveloperr commented 8 months ago

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.