apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bojan Smojver <bo...@rexursive.com>
Subject APR-Util DBD: Binary arguments/return values and unified parsing, 2nd approach
Date Tue, 30 Jan 2007 22:46:29 GMT
This is a rework of the previous patches I sent to the list, but with a
new twist:

- no new structures are introduced to APU

Instead, multiple arguments are passed for BLOB/CLOB type values and
bucket brigade is returned (as in previous patches). MySQL and Oracle
drivers take advantage of brigade being returned and perform multiple
small fetches, rather than one big one.

The other important change is that the unpopular encoding in character
mode (length:table:column:payload, if you recall) of BLOB/CLOB arguments
is also gone. Instead, multiple character arguments are passed in for
such types. A lot more flexible and the caller doesn't have to stuff
already big objects into even bigger objects.

Example in pseudo code:

apr_dbd_prepare("SELECT * FROM TEST WHERE fint = %d AND fclob = %pDc")

And then either:

apr_dbd_pselect("555", "clobdata", "clobsize", "test", "fclob")
----------------------                                ^       ^
                                                      |       |
                                      for Oracle <----+-------+

apr_dbd_pbselect(&dint, "clobdata", &clobsize, "test", "fclob")

Note that for pquery/select all arguments are still (const char *), so
everything is backward compatible. For pbquery/select they are native
APR types (in the above case dint would be int and clobsize would be

Another change is that nargs is _always_ worked out by parsing the
actual statement and legacy nargs passed to pselect/query is ignored.
New binary functions don't even have the nargs argument. You simply must
pass the correct number of values, or things will break.

As previously, this is also in the patches:

- parsing of statements is unified (i.e. not per driver)
- many types have been defined and implemented for all drivers
- binary values (including NULL) returned using apr_dbd_datum_get()

It would be great to get some feedback on this, particularly in terms of
API changes. I'm aware of the CTR policy, but I'm reluctant to commit
this rather big patch without at least some feedback.

As before, patches are in a tarball due to list size restrictions. You
will also find in there a (crude) test program and some SQL scripts to
create test tables.


View raw message