Re: [ANNOUNCE] Class::DBI::Loader 0.12
[prev]
[thread]
[next]
[Date index for 2005/01/27]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Looks great! I will give it a try as soon as I finish my diploma-theses.
Sebastian Riedel wrote:
| 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! ;)
|
- --
Grüsse,
Andreas Fromm
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFB+K9AUmBtSMq5cGURAp9IAJ90WStYz4FAXvQFOMwDl/jqwoHddACg7dLt
DgeVq9DBRgu1dorzgdMyBfE=
=0PX+
-----END PGP SIGNATURE-----
|
|
Re: [ANNOUNCE] Class::DBI::Loader 0.12
Andreas Fromm 09:07 on 27 Jan 2005
|