apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Ingram <d...@dmi.me.uk>
Subject Re: apr_dbd_prepare() corrupts arguments on failure
Date Mon, 13 Oct 2008 10:50:28 GMT
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?    
>> My best bet is that you have pool hierarchy/lifetime problems.
> That's entirely possible - I'm not 100% sure on how I should be using
> them. What would be the best place to find out?

Update: After finding some minimal documentation on the difference
between "cmd->pool" and "cmd->temp_pool", I now allocate prepared_pool
as a sub-pool of cmd->pool and apr_dbd_select() works without any
segfaults, but I'm still having the same problem with apr_dbd_prepare().

I still don't understand how it's changing the contents of my pointer
variables. Am I right to be calling it with NULL for the label argument,
as I'm only using the prepared statement once, in that function? My
reason for using a prepared statement is so that people can use:

<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}
  # ...

without worrying about what the hostname/domain strings actually contain.


View raw message