X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FODBC%2FMicrosoft_SQL_Server.pm;h=6676bfb5e1828556a2ee8e93862adbf347e337db;hb=66c7d805ba0908304807c3b9767afa1a56355f11;hp=544e68c328224bc73427a34990ab01f92d7e4df9;hpb=88e12210acdb453298f90cab7296e538c44bb593;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm b/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm index 544e68c..6676bfb 100644 --- a/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm +++ b/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm @@ -3,108 +3,163 @@ use strict; use warnings; use base qw/DBIx::Class::Storage::DBI::MSSQL/; +use mro 'c3'; -sub insert_bulk { - my ($self, $source, $cols, $data) = @_; +use Carp::Clan qw/^DBIx::Class/; +use List::Util(); +use Scalar::Util (); - my $identity_insert = 0; +__PACKAGE__->mk_group_accessors(simple => qw/ + _using_dynamic_cursors +/); - COLUMNS: - foreach my $col (@{$cols}) { - if ($source->column_info($col)->{is_auto_increment}) { - $identity_insert = 1; - last COLUMNS; - } - } +=head1 NAME + +DBIx::Class::Storage::DBI::ODBC::Microsoft_SQL_Server - Support specific +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 +MSSQL back-end. + +Most of the functionality is provided from the superclass +L. + +=head1 MULTIPLE ACTIVE STATEMENTS + +The following options are alternative ways to enable concurrent executing +statement support. Each has its own advantages and drawbacks. + +=head2 connect_call_use_dynamic_cursors - my $table = $source->from; - if ($identity_insert) { - $source->storage->dbh_do(sub { - my ($storage, $dbh, @cols) = @_; - $dbh->do("SET IDENTITY_INSERT $table ON;"); - }); +Use as: + + on_connect_call => 'use_dynamic_cursors' + +in your L as one way to enable multiple +concurrent statements. + +Will add C<< odbc_cursortype => 2 >> to your DBI connection attributes. See +L for more information. + +Alternatively, you can add it yourself and dynamic cursor will be automatically +enabled. + +This will not work with CODE ref connect_info's and will do nothing if you set +C yourself. + +B this will break C, and C