quote table names that include name_sep
Rafael Kitover [Tue, 30 Jun 2009 00:39:46 +0000 (00:39 +0000)]
lib/DBIx/Class/Schema/Loader/Base.pm
t/17mssql_odbc_dot_in_table_name.t

index f674dcd..fe6c2cf 100644 (file)
@@ -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;
index f608d27..2acf9c9 100644 (file)
@@ -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]');