On Tue, 24 Jan 2023, at 05:21, Veek M wrote:
> Why does the APSW - Python module for sqlite provide us with
> Connection() when it's a wrapper around the C library sqlite3_open() ??
Because that is how Python modules work. You get objects that seem Pythonic but behind the scenes is doing all the necessary work to interface with a C library.
> How do you use sqlite3_open in Python/APSW? The function signature is:
>
> *int sqlite3_open( const char *filename, sqlite3 **db_ptr )*
...
> So what can we use in python for a pointer
If you want to use the C APIs directly then you do not need APSW. Python comes with a module named ctypes that lets you do so:
https://docs.python.org/3/library/ctypes.html
Go ahead and proceed using that, and please let us know how you get on.
> *Everything you can do from the C API to SQLite 3, you can do from Python.*
That is correct - you can write simple Python code and APSW deals with all the C interfacing behind the scenes. There is far more to it that just calling sqlite3_open including lots of memory management, error checking and handling, statement caches, conversion between data formats, iterators ... - over 11,000 lines of C code glue.
Roger