sqlite3 icon indicating copy to clipboard operation
sqlite3 copied to clipboard

SQLITE_ENABLE_UPDATE_DELETE_LIMIT does not work on Linux

Open BlackGlory opened this issue 1 year ago • 2 comments

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

BlackGlory avatar Jan 20 '24 09:01 BlackGlory

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 avatar Mar 31 '24 20:03 DjDeveloperr

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.

DjDeveloperr avatar Apr 05 '24 17:04 DjDeveloperr