apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Donovan <donov...@bellatlantic.net>
Subject Re: apr_dbd_prepare() corrupts arguments on failure
Date Mon, 13 Oct 2008 12:30:24 GMT
Dave Ingram wrote:
> Dave Ingram wrote:
>> Bojan Smojver wrote:
>>>> Actually, it turns out that apr_dbd_prepare() is destroying its
>>>> arguments no matter whether it succeeds or not. What's going on? Does
>>>> anyone have any handy examples of how to use the DBD code?    
>>>
...
> 
> <SQLRepeat "SELECT hostname, domain FROM hosts WHERE status = 1">
> <VirtualHost *:80>
>   ServerName ${hostname}.${domain}
>   <SQLRepeat "SELECT * FROM host_aliases WHERE hostname=? AND domain=?" 
> "${hostname}" "${domain}">
>     ServerAlias ${alias}
>   </SQLRepeat>
>   # ...
> </SQLRepeat>
> 
> without worrying about what the hostname/domain strings actually contain.

With APR 1.3 you must pass string parameters as %s, rather than ?

e.g.
      SELECT * FROM host_aliases WHERE hostname=%s AND domain=%s

mod_vhost_dbd is a little bit like your module.  You might want to look over the source code
for it 
at http://code.google.com/p/dbd-modules/

-tom-

Mime
View raw message