more cleanup stuff, standardized usage of dbh->get_info(29) (sql quote char)
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / Pg.pm
index 62515ff..4e32d48 100644 (file)
@@ -32,28 +32,31 @@ sub _loader_db_classes {
 sub _loader_tables {
     my $class = shift;
     my $dbh = $class->storage->dbh;
+    my $quoter = $dbh->get_info(29) || q{"};
 
     # This is split out to avoid version parsing errors...
     my $is_dbd_pg_gte_131 = ( $DBD::Pg::VERSION >= 1.31 );
-    my @tables = $is_dbd_pg_gte_131 ? 
-        $dbh->tables( undef, $class->_loader_data->{db_schema}, "", "table", { noprefix => 1, pg_noprefix => 1 } )
+    my @tables = $is_dbd_pg_gte_131
+        ?  $dbh->tables( undef, $class->_loader_data->{db_schema}, "",
+                         "table", { noprefix => 1, pg_noprefix => 1 } )
         : $dbh->tables;
 
-    s/"//g for @tables;
+    s/$quoter//g for @tables;
     return @tables;
 }
 
 sub _loader_table_info {
     my ( $class, $table ) = @_;
     my $dbh = $class->storage->dbh;
+    my $quoter = $dbh->get_info(29) || q{"};
 
     my $sth = $dbh->column_info(undef, $class->_loader_data->{db_schema}, $table, undef);
     my @cols = map { $_->[3] } @{ $sth->fetchall_arrayref };
-    s/"//g for @cols;
+    s/$quoter//g for @cols;
     
     my @primary = $dbh->primary_key(undef, $class->_loader_data->{db_schema}, $table);
 
-    s/"//g for @primary;
+    s/$quoter//g for @primary;
 
     return ( \@cols, \@primary );
 }