Protect DBIC as best we can from the failure mode in 7cb35852
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / ODBC / Microsoft_SQL_Server.pm
index 662acb4..4ee00eb 100644 (file)
@@ -9,6 +9,7 @@ use base qw/
 use mro 'c3';
 use Scalar::Util 'reftype';
 use Try::Tiny;
+use DBIx::Class::_Util 'dbic_internal_try';
 use DBIx::Class::Carp;
 use namespace::clean;
 
@@ -24,7 +25,7 @@ to Microsoft SQL Server over ODBC
 =head1 DESCRIPTION
 
 This class implements support specific to Microsoft SQL Server over ODBC.  It is
-loaded automatically by by DBIx::Class::Storage::DBI::ODBC when it detects a
+loaded automatically by DBIx::Class::Storage::DBI::ODBC when it detects a
 MSSQL back-end.
 
 Most of the functionality is provided from the superclass
@@ -143,7 +144,7 @@ sub connect_call_use_mars {
     }
 
     if (my ($data_source) = $dsn =~ /^dbi:ODBC:([\w-]+)\z/i) { # prefix with DSN
-      warn "Bare DSN in ODBC connect string, rewriting as 'dsn=$data_source'"
+      carp_unique "Bare DSN in ODBC connect string, rewriting as 'dsn=$data_source'"
           ." for MARS\n";
       $dsn = "dbi:ODBC:dsn=$data_source";
     }
@@ -227,7 +228,7 @@ sub _run_connection_actions {
     !!$self->_using_dynamic_cursors
   ) {
     if ($use_dyncursors) {
-      try {
+      dbic_internal_try {
         my $dbh = $self->_dbh;
         local $dbh->{RaiseError} = 1;
         local $dbh->{PrintError} = 0;
@@ -308,15 +309,19 @@ sub connect_call_use_server_cursors {
   $self->_get_dbh->{odbc_SQL_ROWSET_SIZE} = $sql_rowset_size;
 }
 
-1;
-
-=head1 AUTHOR
+=head1 FURTHER QUESTIONS?
 
-See L<DBIx::Class/AUTHOR> and L<DBIx::Class/CONTRIBUTORS>.
+Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>.
 
-=head1 LICENSE
+=head1 COPYRIGHT AND LICENSE
 
-You may distribute this code under the same terms as Perl itself.
+This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE>
+by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can
+redistribute it and/or modify it under the same terms as the
+L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>.
 
 =cut
+
+1;
+
 # vim:sw=2 sts=2 et