Re: Doubled column definitions

[prev] [thread] [next] [Date index for 2004/12/30]

From: Drew Taylor
Subject: Re: Doubled column definitions
Date: 13:45 on 30 Dec 2004
On Thu, 30 Dec 2004 09:55:36 +0000, Tony Bowden <tony-cdbitalk@xxxxx.xxx> wrote:
> On Thu, Dec 30, 2004 at 12:21:09AM -0500, Drew Taylor wrote:
> > So after some more digging the problem shows itself in
> > Class::DBI::mysql::set_up_table(). I have mixed case column names (Id,
> > Created, etc). The call to $class->columns(All=>@cols) goes fine. But
> > somewhere in the bowels of ColumnGrouper I end up with the doubled
> > column names.
> 
> A test script that shows the problem would be very handy.

#!/usr/bin/perl
use strict;
use warnings;
use Class::DBI::Loader;

=head1 Database Definition

-- MySQL dump 9.10
--
-- Host: localhost    Database: recipes
-- ------------------------------------------------------
-- Server version       4.0.17

--
-- Table structure for table `BadColumns`
--

CREATE TABLE BadColumns (
  Id int(10) unsigned NOT NULL auto_increment,
  Intro varchar(20) NOT NULL default '',
  PRIMARY KEY  (Id)
) TYPE=MyISAM;

CREATE TABLE goodcolumns (
  id int(10) unsigned NOT NULL auto_increment,
  intro varchar(20) NOT NULL default '',
  PRIMARY KEY (id)
) TYPE=MyISAM;

=cut

my $loader = Class::DBI::Loader->new
    (namespace=>"Foo",
     dsn=>'dbi:mysql:recipes',
     user=>'',
     password=>'',
     );

my @classes = $loader->classes;
print "Classes: [@classes]\n";
foreach (@classes) {
  my @columns = $_->columns;
  print "Columns [@columns]\n";
}

Running the script outputs something like:

bonnie$ perl double_columns.pl 
Classes: [Foo::Badcolumns Foo::Goodcolumns]
Table: [Foo::Badcolumns] Columns [id intro id intro]
Table: [Foo::Goodcolumns] Columns [id intro]


If I make the columns lower case the problem goes away.

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)

Doubled column definitions
Drew Taylor 05:21 on 30 Dec 2004

Re: Doubled column definitions
Tony Bowden 09:55 on 30 Dec 2004

Re: Doubled column definitions
Drew Taylor 13:45 on 30 Dec 2004

Re: Doubled column definitions
Tony Bowden 18:24 on 30 Dec 2004

Re: Doubled column definitions
Drew Taylor 19:00 on 30 Dec 2004

Re: Doubled column definitions
Drew Taylor 19:59 on 30 Dec 2004

Re: Doubled column definitions
Tony Bowden 22:18 on 30 Dec 2004

Re: Doubled column definitions
Drew Taylor 01:29 on 31 Dec 2004

Generated at 12:15 on 16 Jan 2005 by mariachi v0.52