HOW TO EXTEND Class::DBI::ClassGenerator

The module uses some "helper" modules, in which all database-specific code should live. These are named Class::DBI::ClassGenerator::DBD::$dbname.

eg Class::DBI::ClassGenerator::DBD::mysql

where the last part of the module name comes from the DSN that you would use for accessing the database using DBI, and is case-sensitive.

To add support for another database, simply write an appropriate module. You don't need to tell the module about your new extension, as it will find it automatically.

These modules should contain the following class methods. You should probably base your code on Class::DBI::ClassGenerator::DBD::mysql.


Takes a database handle as its only argument and should return a list of all the tables in the database.


Takes a database handle and a table name, returns a hash of columns:

    id => {
        type    => 'INT' # currently this is the native db type and is ignored
        null    => 0,    # true if NULLs are allowed
        pk      => 1,    # true if this column is (part of) a primary key
        default => 0     # the default value
    name => { 
        type => 'VARCHAR(128)',


Written by David Cantrell <>

Copyright 2008 Outcome Technologies Ltd

This documentation is free-as-in-speech. It may be used, distributed and modified under the terms of the Creative Commons Attribution-Share Alike 2.0 UK: England & Wales License, whose text you may read at