apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Darroch <chr...@pearsoncmg.com>
Subject Re: current dbd initiatives
Date Tue, 13 Jun 2006 20:29:59 GMT
Bojan Smojver wrote:

>>    Moreover, if this is the desired behaviour, then migrating from
>> expecting purely string arguments in apr_dbd_pvquery() and
>> apr_dbd_pvselect() to a sprintf()-style mix of strings and other data
>> types surely isn't going to be easy: how do you distinguish a
>> "no more arguments" NULL from an integer zero?
> 
> Easily. You always pass in pointers to data, not data itself. For
> instance:
> 
> int i=0;
> apr_dbd_pvselect([other args],&i,NULL);

   Heh ... well, yes, that's true.  But isn't that drifting rather
far away from the "works like sprintf()" idea?

   Don't get me wrong, BTW -- I like the sprintf()-like notation for
simple queries, and I wish that %d, %u, %f and perhaps one or two others
could be added, and arguments (except strings) passed in by value, in
the manner of sprintf().

   But it seems to me that, first, if the existing PostgreSQL driver's
use of %d to mean "pass an int as a string" isn't changeable until
2.0, then things like %f should mean "pass a float as a string" too,
and that's getting a little far away from Nick's original intention.
So I guess I would be inclined to leave things as-is for a while and
come back to a true sprintf()-style interface in 2.0.

Chris.

-- 
GPG Key ID: 366A375B
GPG Key Fingerprint: 485E 5041 17E1 E2BB C263  E4DE C8E3 FA36 366A 375B

Mime
View raw message