Re: Doubled column definitions
[prev]
[thread]
[next]
[Date index for 2004/12/30]
On Thu, 30 Dec 2004 18:24:50 +0000, Tony Bowden <tony-cdbitalk@xxxxx.xxx> wrote:
> On Thu, Dec 30, 2004 at 08:45:33AM -0500, Drew Taylor wrote:
> > > A test script that shows the problem would be very handy.
> > use Class::DBI::Loader;
> > my $loader = Class::DBI::Loader->new
> > (namespace=>"Foo",
> > dsn=>'dbi:mysql:recipes',
> > user=>'',
> > password=>'',
> > );
>
> I'd rather have one that didn't use Class::DBI::Loader, so that it's
> obvious that the problem is with Class::DBI itself, rather than Loader.
Fair enough. This is one using Class::DBI::mysql directly. I'm pretty
sure the problem is within CDBI, but it's complicated enough that I'm
not sure. The database schema is the same as before.
#!/usr/bin/perl
use strict;
use warnings;
use Class::DBI::mysql;
package Bad;
use strict;
use base 'Class::DBI::mysql';
__PACKAGE__->connection('dbi:mysql:recipes', 'recipe', 'recipe');
__PACKAGE__->set_up_table('BadColumns');
1;
package Good;
use strict;
use base 'Class::DBI::mysql';
__PACKAGE__->connection('dbi:mysql:recipes', 'recipe', 'recipe');
__PACKAGE__->set_up_table('goodcolumns');
1;
package main;
my @classes = qw(Bad Good);
foreach (@classes) {
my @columns = $_->columns;
print "Table: [$_] Columns [@columns]\n";
}
Drew
--
----------------------------------------------------------------
Drew Taylor * Web development & consulting
Email: drew@xxxxxxxxxx.xxx * Site implementation & hosting
Web : www.drewtaylor.com * perl/mod_perl/DBI/mysql/postgres
----------------------------------------------------------------
|
(message missing)
|