apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bojan Smojver <bo...@rexursive.com>
Subject DBD: Prepared statements, BLOBs etc.
Date Mon, 14 Aug 2006 20:58:28 GMT
Some time ago we had quite a few e-mails exchanged about DBD's prepared
statement support and various ways of getting binary data in and out of
prepared statements. So, I prepared these two patches to outline with
code what I had in mind. You may find some of your suggestions in these
patches - this is not by accident.

Before you attempt to compile and run this, let me put it bluntly: these
patches DON'T WORK! They have not been tested at all - they are here
just to express some of the ideas in code. The code in there may (and
most likely does) have serious flaws, even to the point where you could
be scratching you head thinking "what did he want with this". Hopefully,
main ideas will remain visible.

What is in the patches? This (roughly):

- parsing of SQL to find parameters has been moved out of the drivers
and into the upper layer, so it should be identical for all supported
databases

- new functions apr_dbd_pb[v]query/select() have been introduced, which
take "binary" (void *) arguments instead of const char *

- new function apr_dbd_datum_get() has been introduced to fetch binary
data from prepared queries

- structure apr_dbd_blob_t has been defined to pass BLOBs into the query

- SQL to C types have been enumerated

- some situations of in-driver duplication of code have been avoided
(this is mostly as a consequence of new functions being introduced)

- "streaming" of BLOB data using a bucket brigade from MySQL (now there
is some code that *definitely* won't work :-)

- the code should be binary compatible with 1.2.x (i.e. no need to go to
APR-Util 2.x to have this)

- lots and lots of new bugs ;-)

You will find that I haven't done any work on the Oracle driver. It is
simply because I really have no idea about the API. But, I tried to
incorporate some of the concerns raised into the patches (i.e. in terms
of BLOBs). I guess SQLite3, PGSQL and MySQL stuff should be sufficient
enough to represent the ideas.

Criticise away - this is what the patches are for!

PS. Due to size issues on the list, I'll send the MySQL patch in a
separate e-mail.

-- 
Bojan

Mime
View raw message