Switch vestigial warn() calls to carp()
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / ODBC / Microsoft_SQL_Server.pm
index c11634d..073837f 100644 (file)
@@ -36,12 +36,13 @@ L<DBIx::Class::Storage::DBI::MSSQL>.
 
   sudo aptitude install tdsodbc libdbd-odbc-perl unixodbc
 
-In case it is not already there put the following in C</etc/odbcinst.ini>:
+In case it is not already there put the following (adjust for non-64bit arch) in
+C</etc/odbcinst.ini>:
 
   [FreeTDS]
   Description = FreeTDS
-  Driver      = /usr/lib/odbc/libtdsodbc.so
-  Setup       = /usr/lib/odbc/libtdsS.so
+  Driver      = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
+  Setup       = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
   UsageCount  = 1
 
 Set your C<$dsn> in L<connect_info|DBIx::Class::Storage::DBI/connect_info> as follows:
@@ -78,6 +79,10 @@ The following options are alternative ways to enable concurrent executing
 statement support. Each has its own advantages and drawbacks and works on
 different platforms. Read each section carefully.
 
+For more details about using MAS in MSSQL over DBD::ODBC see this excellent
+document provided by EasySoft:
+L<http://www.easysoft.com/developer/languages/perl/multiple-active-statements.html>.
+
 In order of preference, they are:
 
 =over 8
@@ -138,7 +143,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";
     }
@@ -211,6 +216,8 @@ sub connect_call_use_dynamic_cursors {
 sub _run_connection_actions {
   my $self = shift;
 
+  $self->next::method (@_);
+
   # keep the dynamic_cursors_support and driver-state in sync
   # on every reconnect
   my $use_dyncursors = ($self->_dbic_connect_attributes->{odbc_cursortype} || 0) > 1;
@@ -238,16 +245,17 @@ sub _run_connection_actions {
 
       $self->_using_dynamic_cursors(1);
       $self->_identity_method('@@identity');
-      $self->_no_scope_identity_query($self->_using_freetds);
     }
     else {
       $self->_using_dynamic_cursors(0);
       $self->_identity_method(undef);
-      $self->_no_scope_identity_query(undef);
     }
   }
 
-  $self->next::method (@_);
+  $self->_no_scope_identity_query($self->_using_dynamic_cursors
+    ? $self->_using_freetds
+    : undef
+  );
 
   # freetds is too damn broken, some fixups
   if ($self->_using_freetds) {
@@ -264,7 +272,7 @@ sub _run_connection_actions {
 
     # FreeTDS is too broken wrt execute_for_fetch batching
     # just disable it outright until things quiet down
-    $self->_get_dbh->{odbc_disable_array_operations} = 1;
+    $self->_disable_odbc_array_ops;
   }
 }