package SQL::Translator::Parser::DBI::SQLServer;
-# -------------------------------------------------------------------
-# Copyright (C) 2002-2009 SQLFairy Authors
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; version 2.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-# 02111-1307 USA
-# -------------------------------------------------------------------
-
=head1 NAME
SQL::Translator::Parser::DBI::SQLServer - parser for SQL Server through DBD::ODBC
=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';
# 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}
# add in foreign keys
$h = $dbh->selectall_hashref("sp_fkeys NULL,
-\@fktable_name = '$table_info->{TABLE_NAME}'", 'FK_NAME');
+\@fktable_name = '[$table_info->{TABLE_NAME}]'", 'FK_NAME');
foreach my $fk ( values %{$h} ) {
my $constraint = $table->add_constraint( name => $fk->{FK_NAME},
fields => [$fk->{FKCOLUMN_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;