From: Rafael Kitover Date: Wed, 1 Jul 2009 11:30:38 +0000 (+0000) Subject: minor changes X-Git-Tag: 0.04999_08~2^2~16 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=af8f627907ce02b59cec8ee788917b81367802aa;p=dbsrgits%2FDBIx-Class-Schema-Loader.git minor changes --- diff --git a/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm b/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm index 8611bf7..5ef2905 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm @@ -42,19 +42,19 @@ sub _setup { $self->next::method(@_); - $self->{db_schema} ||= $self->_determine_db_schema; + $self->{db_schema} ||= $self->_build_db_schema; } -sub _determine_db_schema { +sub _build_db_schema { my $self = shift; my $dbh = $self->schema->storage->dbh; my $test_table = "_loader_test_$$"; - $dbh->do("create table $test_table (id integer)"); my $db_schema = 'dbo'; # default eval { + $dbh->do("create table $test_table (id integer)"); my $sth = $dbh->prepare('sp_tables'); $sth->execute; while (my $row = $sth->fetchrow_hashref) { @@ -64,10 +64,12 @@ sub _determine_db_schema { last; } $sth->finish; + $dbh->do("drop table $test_table"); }; my $exception = $@; - $dbh->do("drop table $test_table"); - croak $exception if $exception; + eval { $dbh->do("drop table $test_table") }; + carp "Could not determine db_schema, defaulting to $db_schema : $exception" + if $exception; return $db_schema; } diff --git a/t/16mssql_common.t b/t/16mssql_common.t index f64b0b4..898ef6d 100644 --- a/t/16mssql_common.t +++ b/t/16mssql_common.t @@ -8,7 +8,6 @@ my $password = $ENV{DBICTEST_MSSQL_PASS} || ''; my $tester = dbixcsl_common_tests->new( vendor => 'Microsoft', - quote_char => [qw/[ ]/], auto_inc_pk => 'INTEGER IDENTITY NOT NULL PRIMARY KEY', dsn => $dsn, user => $user, diff --git a/t/16mssql_odbc_common.t b/t/16mssql_odbc_common.t index 893bb8e..fdf1888 100644 --- a/t/16mssql_odbc_common.t +++ b/t/16mssql_odbc_common.t @@ -8,7 +8,6 @@ my $password = $ENV{DBICTEST_MSSQL_ODBC_PASS} || ''; my $tester = dbixcsl_common_tests->new( vendor => 'Microsoft', - quote_char => [qw/[ ]/], auto_inc_pk => 'INTEGER IDENTITY NOT NULL PRIMARY KEY', dsn => $dsn, user => $user, diff --git a/t/lib/dbixcsl_common_tests.pm b/t/lib/dbixcsl_common_tests.pm index a8ab6b7..989c5a8 100644 --- a/t/lib/dbixcsl_common_tests.pm +++ b/t/lib/dbixcsl_common_tests.pm @@ -1185,7 +1185,8 @@ sub drop_tables { sub DESTROY { my $self = shift; $self->drop_tables if $self->{_created}; - rmtree $DUMP_DIR; + rmtree $DUMP_DIR + unless $ENV{SCHEMA_LOADER_TESTS_NOCLEANUP}; } 1;