vendredi 18 décembre 2015

Use of DELETE LIMIT OFFSET with ENABLE_UPDATE_DELETE_LIMIT

I would like to use the optional LIMIT and ORDER BY clause for DELETE statements in SQLite. I can verify that SQLite was built with SQLITE_ENABLE_UPDATE_DELETE_LIMIT:

sqlite> PRAGMA compile_options;
ENABLE_COLUMN_METADATA
ENABLE_FTS3
ENABLE_FTS3_PARENTHESIS
ENABLE_FTS4
ENABLE_RTREE
ENABLE_UNLOCK_NOTIFY
ENABLE_UPDATE_DELETE_LIMIT
SECURE_DELETE
SYSTEM_MALLOC
TEMP_STORE=1
THREADSAFE=1

Anyway, when I run the following query on my table logs (CREATE TABLE logs(id INTEGER PRIMARY KEY AUTOINCREMENT, time INTEGER DEFAULT CURRENT_TIMESTAMP, type INTEGER NOT NULL ON CONFLICT ABORT, entry TEXT NOT NULL ON CONFLICT ABORT)), this happens:

sqlite> DELETE FROM logs WHERE type = 0 ORDER BY time LIMIT -1 OFFSET 100;
Error: near "ORDER": syntax error

What did I do wrong?

Aucun commentaire:

Enregistrer un commentaire