To increase the similarity between this module and CPythons sqlite3 module
the commit() and rollback() as defined in CPythons version have been
added, along with the different (auto)commit behaviors present there.
The defaults are also set to the same as in CPython, and can be changed
with the same parameters in connect(), as is showcased in the new test.
Signed-off-by: Robert Klink <rhermanklink@ripe.net>
The sqlite3_prepare and sqlite3_close have been changed to use the v2
version. For the prepare this was done as the v1 version is "legacy",
and for close the documentation describes the v2 version to be used for
"host languages that are garbage collected, and where the order in
which destructors are called is arbitrary", which fits here.
Some clean-up to comments has also be done, and the tests now also
close the Cursor and Connections.
Signed-off-by: Robert Klink <rhermanklink@ripe.net>
This commit adds the ability to enable URI on the connect, as can be done
in the cpython sqlite3 module. URI allows, among other things, to create
a shared named in-memory database, which non URI filenames cannot create.
Signed-off-by: Robert Klink <rhermanklink@ripe.net>
Currently, statements are only finalized upon a call to Cursor.close().
However, in Cursor.execute() new statements get created without the
previous statements being finalized, causing those to get leaked,
preventing the database from being closed. The fix addresses this by
finalizing the previous statement if it exists.
Signed-off-by: Robert Klink <rhermanklink@ripe.net>
Currently, the bytes object used to store the sqlite3 database pointer
is always 4 bytes, which causes segfaults on 64 bit platforms with 8
byte pointers. To address this, the size is now dynamically determined
using the uctypes modules pointer size.
Signed-off-by: Robert Klink <rhermanklink@ripe.net>