Nick Kew wrote:
> Dave Ingram wrote:
>
>> First off, if this isn't the correct place to ask this then I apologise,
>> but it seemed the most appropriate list. If there's somewhere more
>> appropriate, please let me know.
>>
>> I've had a quick look for some information on accessing a database via
>> APR, and after glancing through the header files, I still have a
>> question: is it possible to get the column names from the query results?
>
> Yes, with sufficiently up-to-date versions of apr_dbd and mod_dbd.
> Hints about how it works can be found in the relevant CHANGES files.
>
> Sorry to be terse, but it would take too long to dig up URLs
> from here.
That's fine - all I really wanted was to know if it's possible, and a
nudge in the right direction -- thanks!

>> [snip - moved lower and improved]
>
> Interesting idea.  Are you familiar with mod_vhost_dbd, and even
> mod_macro, which do somewhat-related things?
Yes indeed, although I only used the VirtualHost example as it's the
most often-used. Unless I'm much mistaken, mod_vhost_dbd only allows you
to set the document root, and all other mass virtualhosting solutions
that I've seen are quite limited -- nowhere near this flexible.

Say you wanted to add some redirects to your virtual hosts too, after
the directories have been rearranged, for example... as far as I know,
no module allows you to do anything like this:

<SQLRepeat "SELECT baz, bar, qux FROM sometable WHERE baz='foo'">
<VirtualHost *:80>
  DocumentRoot /www/root/path/$baz
  ServerName $bar
  ServerAdmin $qux
  <SQLRepeat "SELECT was, now FROM redirects WHERE type='permanent' AND
servername = ?" $bar>
    RedirectPermanent "$was" "$now"
  </SQLRepeat>
</VirtualHost>
</SQLRepeat>

If you're interested, I've posted a bit more about it on my blog while
I'm still fleshing out the idea:
http://www.dmi.me.uk/blog/2008/08/13/modules-for-apache-and-php/

I've been looking at mod_macro for inspiration and to see how it does
the substitution/re-parsing, and I think I may end up borrowing a few
chunks of its code to avoid re-inventing the wheel...


Dave

Reply via email to