[Tutor] sqlite3 does it support limit in a delete clause?

eryksun eryksun at gmail.com
Fri Feb 22 04:41:32 CET 2013


On Thu, Feb 21, 2013 at 8:47 PM, Jim Byrnes <jf_byrnes at comcast.net> wrote:
> ubuntu 12.04 python 2.7
>
> Does sqlite3 in this version of python support a delete with a limit?

It's enabled via the compilation option SQLITE_ENABLE_UPDATE_DELETE_LIMIT:

http://www.sqlite.org/compile.html/#enable_update_delete_limit

This is not enabled for Windows Python 2.7/3.3. However, I'm surprised
it's disabled in Ubuntu since Debian's Python 2.7.3 has it. I checked
this with a temp database in memory and also verified via the
diagnostic functions (themselves optional):

http://www.sqlite.org/c3ref/compileoption_get.html

    >>> from ctypes import *
    >>> import _sqlite3
    >>> lib = CDLL(_sqlite3.__file__)

    >>> lib.sqlite3_compileoption_used(
    ...     "ENABLE_UPDATE_DELETE_LIMIT")
    1

    >>> lib.sqlite3_compileoption_get.restype = c_char_p
    >>> i = 0
    >>> while True:
    ...   opt = lib.sqlite3_compileoption_get(i)
    ...   if not opt: break
    ...   print opt
    ...   i += 1
    ...
    CURDIR
    ENABLE_COLUMN_METADATA
    ENABLE_FTS3
    ENABLE_RTREE
    ENABLE_UNLOCK_NOTIFY
    ENABLE_UPDATE_DELETE_LIMIT
    MAX_SCHEMA_RETRY=25
    OMIT_LOOKASIDE
    SECURE_DELETE
    SOUNDEX
    TEMP_STORE=1
    THREADSAFE=1


More information about the Tutor mailing list