[Dbix-class] [PATCH] Schema::Loader with reserved table name

Matt S Trout dbix-class at trout.me.uk
Wed Aug 1 11:05:12 GMT 2007


On Wed, Aug 01, 2007 at 12:06:37AM -0700, Tatsuhiko Miyagawa wrote:
> The following patch fixes some weird bugs when I used the table name
> 'show' with mysql.

Wonder if quote_identifier is widely-support yet. If not Schema::Loader
should probably switch to using a storage object.
 
> I'm not subscribed to the -devel mailing list. Forward this if needed.

We haven't bothered splitting them, the traffic's never been high enough for
it to matter.

> --- DBIx/Class/Schema/Loader/DBI.pm.old 2006-11-01 08:34:03.000000000 -0800
> +++ DBIx/Class/Schema/Loader/DBI.pm     2007-07-31 06:29:30.000000000 -0700
> @@ -91,7 +91,7 @@
>          $table = $self->{db_schema} . $self->{_namesep} . $table;
>      }
> 
> -    my $sth = $dbh->prepare("SELECT * FROM $table WHERE 1=0");
> +    my $sth = $dbh->prepare("SELECT * FROM " .
> $dbh->quote_identifier($table) . " WHERE 1=0");
>      $sth->execute;
>      return \@{$sth->{NAME_lc}};
>  }
> 
> 
> -- 
> Tatsuhiko Miyagawa
> 
> _______________________________________________
> List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
> Wiki: http://dbix-class.shadowcatsystems.co.uk/
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
> Searchable Archive: http://www.mail-archive.com/dbix-class@lists.rawmode.org/

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/                    http://www.shadowcat.co.uk/ 



More information about the DBIx-Class mailing list