Skip Menu |

This queue is for tickets about the Class-DBI-Loader CPAN distribution.

Report information
The Basics
Id: 5017
Status: resolved
Priority: 0/
Queue: Class-DBI-Loader

People
Owner: ikebe [...] shebang.jp
Requestors: simon [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.01
Fixed in: (no value)



Subject: Mysql loader broken by mysql 4.0.17 / DBD 2.9003
The mysql DBD now returns the tables in ->tables quoted by a backtick: If "$dbh->get_info(29)" returns true (29 is SQL_IDENTI- FIER_QUOTE_CHAR) then the table names are constructed and quoted by "quote_identifier" to ensure they are usable even if they contain whitespace or reserved words etc. This means that the table names returned will include quote characters. This means the class names end up being "MyApp::`foo`". --- Class/DBI/Loader/mysql.pm~ 2004-01-24 11:47:59.000000000 +0000 +++ Class/DBI/Loader/mysql.pm 2004-01-24 11:50:05.000000000 +0000 @@ -15,7 +15,7 @@ my $self = shift; my $dbh = DBI->connect(@{$self->_datasource}) or _croak($DBI::errstr); foreach my $table($dbh->tables) { - my $class = $self->_table2class($table); + my $class = $self->_table2class($table, $dbh); no strict 'refs'; @{"$class\::ISA"} = qw(Class::DBI::mysql); $class->set_db(Main => @{$self->_datasource}); --- Class/DBI/Loader/Generic.pm~ 2004-01-24 11:48:23.000000000 +0000 +++ Class/DBI/Loader/Generic.pm 2004-01-24 11:54:19.000000000 +0000 @@ -41,10 +41,13 @@ } sub _table2class { - my($self, $table) = @_; + my($self, $table, $dbh) = @_; my $namespace = $self->{_namespace} || ""; $namespace =~ s/(.*)::$/$1/; my $subclass = $table; + if ($dbh and my $quoter = $dbh->get_info(29)) { + $subclass =~ s/$quoter//g; + } $subclass =~ s/_(\w)/ucfirst($1)/eg; my $class = $namespace ? "$namespace\::". ucfirst($subclass) : ucfirst($subclass); }
Thanks for patch. I fixed the problem and upload to CPAN.