Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 65591 invoked from network); 28 Nov 2004 06:01:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 28 Nov 2004 06:01:22 -0000 Received: (qmail 30871 invoked by uid 500); 28 Nov 2004 06:01:21 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 30092 invoked by uid 500); 28 Nov 2004 06:01:19 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 30072 invoked by uid 99); 28 Nov 2004 06:01:19 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from force-elite.com (HELO utopia.in.force-elite.com) (216.255.199.145) by apache.org (qpsmtpd/0.28) with ESMTP; Sat, 27 Nov 2004 22:01:17 -0800 X-AuthUser: chip@force-elite.com Received: from [10.0.0.101] (10.0.0.101:56773) by utopia.in.force-elite.com with [XMail 1.17 (Linux/Ix86) ESMTP Server] id for from ; Sat, 27 Nov 2004 22:01:14 -0800 Message-ID: <41A969AD.6070601@force-elite.com> Date: Sat, 27 Nov 2004 22:01:17 -0800 From: Paul Querna User-Agent: Mozilla Thunderbird 0.9 (Macintosh/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: dev@httpd.apache.org Subject: Re: Towards a generic database connection API References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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