[CDBI] DBI's last_insert_id and Class::DBI's _auto_increment_value

David Steinbrunner carbon at pobox.com
Tue Nov 22 14:43:52 GMT 2005


Kingsley Kerce wrote:

>> To get Postgres to work without modifying CDBI I have the sequence being
>> defined but that then breaks MySQL.  The sequence lines are currently
>> commented out in the script so you can test the first case first.
> 
> Have you explored the use of Class::DBI::Pg and Class::DBI::mysql?
> They may abstract away your problem.

After looking into Class::DBI::Pg a little it does have the ability to look
up the sequence and define it in the set_up_table.  This is cool but not
exactly transparent because to get this functionality I need to have
Class::DBI::Pg be my base class which would then still excluded mysql from
working.

Unless there is some way to dynamically set your base class...  My idea is
to have a config file that will store system settings including DB host,
name, user pass and driver.  Is there some way to query the config and then
have:

use base "Class::DBI::$dbd";

It does not seem possible but I have been wrong about stranger things.
Maybe there is a different way to achieve the same type of thing?

--
David Steinbrunner






More information about the ClassDBI mailing list