NAME

DBSimple::DB - an abstract interface to databases

SYNOPSIS

use DBSimple::DB;
my $dbdef = new DBSimple::DB 'database';
my $db = $dbdef->open;
my $table = &tabledef;		# get a DBSimple::Table object
$table->bind($db);
return $table->select('user', [ 'hugo', 'hv' ]);

DESCRIPTION

This is intended to be an abstract interface to databases, such that you don't need to know irritating details like what sort of database it is to be able to access it in a perl script.

Currently the only supported database types are Msql versions 1 and 2; the intention is that only this module will need to know where each database is, and what type it is.

This is an abstract base class: implementation for a specific database involves writing an additional package that inherits from DBSimple::DB. If you need to do this, look at DBSimple::Msql for an example of how to. In brief though, you need to provide the constructors and methods described below (for when the object is treated like a DBSimple::DB), and a load more for a DBSimple::Table object to access after it has been bound.

Everything is a method - nothing is exported.

CONSTRUCTOR

new ( name )

Creates and returns a DBSimple::DB object. Well, it doesn't actually. What it really does is to look up what sort of database it is (from this little list it has) and go call the constructor from the package that handles that sort of database.

METHODS

type ( )

Returns a string naming the type of database this object represents. All derived classes should overload this.

open ( )

Opens a connection to the database this object represents. All derived classes should overload this.

FUTURE

Well, implement other database types, I guess.

It would probably be useful to be able to register database names, locations and types rather than embedding them here, but it is definitely useful to have those descriptions in a single well known place.

Please note: I plan to change the interface to this stuff quite a lot in the near future.

HISTORY

v0.02 Hugo 29/3/97

cleaned up some for external release

v0.01 written by Hugo before 15/11/96