DB and DBCompat

Bradley Baetz bbaetz at acm.org
Sat Sep 6 09:36:40 UTC 2003

On Sat, Sep 06, 2003 at 10:34:18AM +0200, Jeroen Ruigrok/asmodai wrote:
> Ok, so query related stuff in DBCompat and the rest in DB.  Works for
> me.

Well, possibly :)
> >I'm not sure that connect needs to be overloaded, however - all that we
> >need is the DBD name, and DBI takes care of the rest, in theory.
> Problem is, you need to overload it: DBD::mysql uses database=, DBD::Pg
> uses dbname=, DBD::Oracle uses sid=, DBD::Sybase uses server= and/or
> database=, Informix expects dbi:Informix:$database.

I'd like to combine the various localconfig params
(server/port/socket/etc) into 'DSN string', which we can then pass in as

This makes stuff a lot easier, for example if you want to use a unix
domain socket on postgres rather than tcpip, you must not specify a
hostname. With mysql (libmysql rather than DBD, IIRC) localhost implies
the 'standard' socket location.

> >I'm not too sure how realistic that is, though. Maybe we need to make a
> >list of what sort of stuff we need in the compat module.
> The way it looks now, it seems as if all database related code needs to
> be made RDBMS agnostic, so I fear that both DB and DBCompat will have
> if/elsif cases for all databases supported.

I'd prefer inheritance, so that another DB type can be pretty
much dropped in without having to add extra if/elsif stuff. It makes the
code look cleaner too. Consider the auth modules, for example. The
'inheritance' they do is a bit ugly, so we may want to play with symbol
tables directly instead.


More information about the developers mailing list