Quote table_name to fix tables using reserve words as their name
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Parser / DBI / Sybase.pm
index 2508c4a..f3bfe74 100644 (file)
@@ -15,17 +15,17 @@ Uses DBI Catalog Methods.
 =cut
 
 use strict;
+use warnings;
 use DBI;
 use SQL::Translator::Schema;
 use Data::Dumper;
 
-use vars qw[ $DEBUG $VERSION @EXPORT_OK ];
-$VERSION = '1.59';
+our ( $DEBUG, @EXPORT_OK );
+our $VERSION = '1.59';
 $DEBUG   = 0 unless defined $DEBUG;
 
 no strict 'refs';
 
-# -------------------------------------------------------------------
 sub parse {
     my ( $tr, $dbh ) = @_;
 
@@ -212,7 +212,7 @@ $table_info->{TABLE_TYPE},
 
             # add in primary key
             my $h = $dbh->selectall_hashref("sp_pkeys
-$table_info->{TABLE_NAME}", 'COLUMN_NAME');
+[$table_info->{TABLE_NAME}]", 'COLUMN_NAME');
             if (scalar keys %{$h} > 1) {
                 my @c = map {
                     $_->{COLUMN_NAME}
@@ -230,7 +230,7 @@ $table_info->{TABLE_NAME}", 'COLUMN_NAME');
 
             if (defined($stuff->{indexes}->{$table_info->{TABLE_NAME}})){
                 my $h = $dbh->selectall_hashref("sp_helpindex
-$table_info->{TABLE_NAME}", 'INDEX_NAME');
+[$table_info->{TABLE_NAME}]", 'INDEX_NAME');
                 foreach (values %{$h}) {
                     my $fields = $_->{'INDEX_KEYS'};
                     $fields =~ s/\s*//g;
@@ -300,8 +300,6 @@ $table_info->{TABLE_NAME},
 
 1;
 
-# -------------------------------------------------------------------
-
 =pod
 
 =head1 AUTHOR