[Bast-commits] r6910 - in branches/DBIx-Class-Schema-Loader/mssql_tweaks: lib/DBIx/Class/Schema/Loader/DBI t t/lib

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Wed Jul 1 11:30:39 GMT 2009


Author: caelum
Date: 2009-07-01 11:30:38 +0000 (Wed, 01 Jul 2009)
New Revision: 6910

Modified:
   branches/DBIx-Class-Schema-Loader/mssql_tweaks/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm
   branches/DBIx-Class-Schema-Loader/mssql_tweaks/t/16mssql_common.t
   branches/DBIx-Class-Schema-Loader/mssql_tweaks/t/16mssql_odbc_common.t
   branches/DBIx-Class-Schema-Loader/mssql_tweaks/t/lib/dbixcsl_common_tests.pm
Log:
minor changes

Modified: branches/DBIx-Class-Schema-Loader/mssql_tweaks/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/mssql_tweaks/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm	2009-07-01 11:27:15 UTC (rev 6909)
+++ branches/DBIx-Class-Schema-Loader/mssql_tweaks/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm	2009-07-01 11:30:38 UTC (rev 6910)
@@ -42,19 +42,19 @@
 
     $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 @@
             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;
 }

Modified: branches/DBIx-Class-Schema-Loader/mssql_tweaks/t/16mssql_common.t
===================================================================
--- branches/DBIx-Class-Schema-Loader/mssql_tweaks/t/16mssql_common.t	2009-07-01 11:27:15 UTC (rev 6909)
+++ branches/DBIx-Class-Schema-Loader/mssql_tweaks/t/16mssql_common.t	2009-07-01 11:30:38 UTC (rev 6910)
@@ -8,7 +8,6 @@
 
 my $tester = dbixcsl_common_tests->new(
     vendor      => 'Microsoft',
-    quote_char  => [qw/[ ]/],
     auto_inc_pk => 'INTEGER IDENTITY NOT NULL PRIMARY KEY',
     dsn         => $dsn,
     user        => $user,

Modified: branches/DBIx-Class-Schema-Loader/mssql_tweaks/t/16mssql_odbc_common.t
===================================================================
--- branches/DBIx-Class-Schema-Loader/mssql_tweaks/t/16mssql_odbc_common.t	2009-07-01 11:27:15 UTC (rev 6909)
+++ branches/DBIx-Class-Schema-Loader/mssql_tweaks/t/16mssql_odbc_common.t	2009-07-01 11:30:38 UTC (rev 6910)
@@ -8,7 +8,6 @@
 
 my $tester = dbixcsl_common_tests->new(
     vendor      => 'Microsoft',
-    quote_char  => [qw/[ ]/],
     auto_inc_pk => 'INTEGER IDENTITY NOT NULL PRIMARY KEY',
     dsn         => $dsn,
     user        => $user,

Modified: branches/DBIx-Class-Schema-Loader/mssql_tweaks/t/lib/dbixcsl_common_tests.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/mssql_tweaks/t/lib/dbixcsl_common_tests.pm	2009-07-01 11:27:15 UTC (rev 6909)
+++ branches/DBIx-Class-Schema-Loader/mssql_tweaks/t/lib/dbixcsl_common_tests.pm	2009-07-01 11:30:38 UTC (rev 6910)
@@ -1185,7 +1185,8 @@
 sub DESTROY {
     my $self = shift;
     $self->drop_tables if $self->{_created};
-    rmtree $DUMP_DIR;
+    rmtree $DUMP_DIR
+	unless $ENV{SCHEMA_LOADER_TESTS_NOCLEANUP};
 }
 
 1;




More information about the Bast-commits mailing list