-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Gerhard Häring wrote:
| By adding this:
|
| sqlite.enable_callback_tracebacks(1)
|
| You get more tracebacks printed to stderr when errors happen in callback
| functions (functions, aggregates, authorizers, etc.).
The point is that you shouldn't be printing tracebacks or swallowing the
exceptions in similar ways. It should be handled by the calling code
like how exceptions normally work.
| There once was a good reason for doing it this way, but I forgot what
| exactly it was ;-) It had something to do with another error masking the
| original one in some cases, IIRC.
You just have to code carefully. In APSW I use PyErr_Occurred() to see
if an exception has already occurred and if so, don't stomp all over it.
| They would sure be fun to use from Python, I'd really like to play with
| them. I even started implementing them in pysqlite, but it's a lot to wrap
| and will take a quite some time.
My code is complete and I am updating the test suite. There are also a
lot of issues to deal with in SQLite itself as error behaviour is
undocumented and the code isn't much better. For example if you return
an error code to the function that closes a virtual table, is the table
still live (ie keep objects around) or dead (ie destroy objects). I've
raised several tickets which drh hasn't responded to yet.
I also can't see any way to implement xFilter that doesn't hang on to
returned objects until the Connection object is closed.
| If we could integrate APSW and pysqlite in such a way that I could
| implement virtual tables on pysqlite connections, that would be really
| great. Basically what we'd need is some way that APSW could make sense
of a
| pysqlite connection object and use its sqlite3* handle. Do you think
that's
| feasible?
It is certain feasible but there are some issues. Firstly we need to
agree on a method name that gets the handle (pointer) out of the object
in the first place. That would also be useful to ctypes users. The
Create/Connect method is passed the db handle as the first parameter.
Currently I save the connection object (PyObject) in the createmodule
implementation, and then use that in the callback code so you get OOR
(original object return).
You will also get SQLite/apsw semantics. For example the function
implemented by the developer to return a field can only return one of
None, int, float, string or buffer. There is no automatic type
mangling. Also all exceptions thrown are apsw objects.
Lastly this is going to require SQLite 3.3.8 at a minimum, but there is
no way around that.
Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
iD8DBQFFeRr1mOOfHg372QQRAi3qAJ9oMBO97IKoUNi4/fVbZGUKEcM2HACfYgBx
pdAnm3NpSaQIQ7rv5PcA3nw=
=L3ed
-----END PGP SIGNATURE-----
_______________________________________________
pysqlite mailing list
pysqlite@xxxxxxxxxxxxxxx
http://lists.initd.org/mailman/listinfo/pysqlite
|
|