From: Rafael Kitover Date: Tue, 30 Jun 2009 00:39:46 +0000 (+0000) Subject: quote table names that include name_sep X-Git-Tag: 0.04999_08~2^2~21 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ff30991a151ca31a9331adf0e3f34dc23e498ada;p=dbsrgits%2FDBIx-Class-Schema-Loader.git quote table names that include name_sep --- diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index f674dcd..fe6c2cf 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -672,7 +672,14 @@ sub _setup_src_meta { my $table_class = $self->classes->{$table}; my $table_moniker = $self->monikers->{$table}; - $self->_dbic_stmt($table_class,'table',$table); + my $table_name = $table; + my $name_sep = $self->schema->storage->sql_maker->name_sep; + + if ($table_name =~ /\Q$name_sep\E/) { + $table_name = \ $self->_quote_table_name($table_name); + } + + $self->_dbic_stmt($table_class,'table',$table_name); my $cols = $self->_table_columns($table); my $col_info; diff --git a/t/17mssql_odbc_dot_in_table_name.t b/t/17mssql_odbc_dot_in_table_name.t index f608d27..2acf9c9 100644 --- a/t/17mssql_odbc_dot_in_table_name.t +++ b/t/17mssql_odbc_dot_in_table_name.t @@ -48,12 +48,9 @@ eval { ok !$@, 'table name with . parsed correctly'; diag $@ if $@; -## this doesn't work either -system qq{$^X -pi -e 's/"test\.dot"/\\\\"[test.dot]"/' t/_common_dump/TestSL/Schema/Result/TestDot.pm}; - +#system qq{$^X -pi -e 's/"test\.dot"/\\\\"[test.dot]"/' t/_common_dump/TestSL/Schema/Result/TestDot.pm}; #diag do { local ($/, @ARGV) = (undef, "t/_common_dump/TestSL/Schema/Result/TestDot.pm"); <> }; - -do "t/_common_dump/TestSL/Schema/Result/TestDot.pm"; +#do "t/_common_dump/TestSL/Schema/Result/TestDot.pm"; eval 'use TestSL::Schema'; ok !$@, 'loaded schema'; @@ -74,6 +71,6 @@ and it doesn't work in the released version yet}; diag $@ if $@; } -#rmtree $DUMP_DIR; +rmtree $DUMP_DIR; $dbh->do('DROP TABLE [test.dot]');