[ANNOUNCE] Class::DBI::Loader 0.12

[prev] [thread] [next] [Date index for 2005/01/27]

From: Sebastian Riedel
Subject: [ANNOUNCE] Class::DBI::Loader 0.12
Date: 07:11 on 27 Jan 2005
Hi,

I just uploaded a new version of Class::DBI::Loader to CPAN.

It now supports automatic relationships for all three databases
(PostgreSQL, MySQL and SQLite)!

The code for MySQL was contributed by Adam Anderson is completely
untested by me, so i count on your feedback!

SQLite needs this small patch to be applied to Class::DBI::SQLite. (Lets
hope Tatsuhiku applies it soon to the CPAN version)
It bypasses a limitation in SQL::Parser.

35a36,38
>     # sri: Needed for auto relationships with Class::DBI::Loader
>     $sql =~ s/REFERENCES\s+\w+//gsi;
>

And the obligatory example:

use DBI;
use Class::DBI::Loader;

unlink 'test.db' if -e 'test.db';

my $dbh = DBI->connect('dbi:SQLite2:test.db');

$dbh->do(<<"");
CREATE TABLE foo (
    id INTEGER PRIMARY KEY,
    test TEXT
);

$dbh->do(<<"");
CREATE TABLE bar (
    id INTEGER PRIMARY KEY,
    test TEXT
);

$dbh->do(<<"");
CREATE TABLE yada (
    id INTEGER PRIMARY KEY,
    foo INTEGER REFERENCES foo,
    bar INTEGER REFERENCES bar
);

$dbh->disconnect;

my $loader = Class::DBI::Loader->new(
    dsn           => 'dbi:SQLite2:test.db',
    namespace     => 'Data',
    relationships => 1,
    debug         => 1
);

Yes i'm exploiting things a bit, but who cares when you get automatic
relationships, right?

And welcome to a new highly dynamic world! ;)

        -- 
        sebastian

[ANNOUNCE] Class::DBI::Loader 0.12
Sebastian Riedel 07:11 on 27 Jan 2005

Re: [ANNOUNCE] Class::DBI::Loader 0.12
Andreas Fromm 09:07 on 27 Jan 2005

Re: [ANNOUNCE] Class::DBI::Loader 0.12
Jay Strauss 14:32 on 27 Jan 2005

Re: [Maypole] Re: [ANNOUNCE] Class::DBI::Loader 0.12
Perrin Harkins 16:20 on 27 Jan 2005

Re: [ANNOUNCE] Class::DBI::Loader 0.12
Tatsuhiko Miyagawa 18:56 on 27 Jan 2005

Generated at 12:39 on 05 Feb 2005 by mariachi v0.52