httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Querna <c...@force-elite.com>
Subject Re: Towards a generic database connection API
Date Sun, 28 Nov 2004 06:01:17 GMT
Nick Kew wrote:
> I have recently developed a first-draft namespace module mod_sql for
> incorporating SQL into HTML/XML pages with mod_publisher or mod_xmlns.
> 
> In doing so, I revisited the existing database connection pooling modules,
> and reclassified them as drivers for mod_sql.  I also added support for
> LAMP-style single persistent connections for use in non-threaded MPMs,
> using #if APR_HAS_THREADS.
> 
> That basically means each database module is an ap_provider for "dbd",
> and implements a common API.

+1 in concept from me.  One thing I think needs to be kept in mind is a 
separation from Apache-ism so it could be used by Python/PHP/Perl 
without requiring Apache.

> I'd like the DBD API to be generic, and to work for other modules that
> use an SQL backend, ranging from specific modules such as SQL-based
> authentication and logging to general frameworks such as Perl, Python
> and PHP.  I don't know to what extent that's going to prove feasible,
> but perhaps my current draft can serve as a startingpoint.  What I'd
> really like at this stage is feedback from other developers connecting
> Apache to an SQL backend.

One thing I believe that is missing from the current API is a method to 
store a result set into a var, and then iterate that whenever you want. 
(Plus seeking within a result set).

> Description and source code at
> http://apache.webthing.com/database/

An API to use as a starting point might be libdbi.  Its public interface 
is at http://libdbi.sourceforge.net/docs/programmers-guide/

They also have a set of documentation on the design of the Database 
Driver's API at http://libdbi.sourceforge.net/docs/driver-guide/

I really like using libdbi, and I have used it for several apache 
modules, but its memory management is a painful hack where you are 
required to free() and malloc() things yourself.  I would love a libdbi
like interface that fully embraced pools. Anyone else?

If we get to a working code-base, I would like to investigate adding it 
to APR-Util.

-Paul Querna


Mime
View raw message