From: Rafael Kitover Date: Thu, 30 Jul 2009 16:57:22 +0000 (+0000) Subject: add missing file X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=57ee81d0323c30761d7ec977e1c6d4e1095adb81;p=dbsrgits%2FDBIx-Class-Historic.git add missing file --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index db51e01..f975986 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -1144,6 +1144,7 @@ sub _execute { sub insert { my ($self, $source, $to_insert) = @_; +# redispatch to insert method of storage we reblessed into, if necessary if (not $self->_driver_determined) { $self->_determine_driver; goto $self->can('insert'); diff --git a/lib/DBIx/Class/Storage/DBI/MSSQL.pm b/lib/DBIx/Class/Storage/DBI/MSSQL.pm index 37733f6..8d58a40 100644 --- a/lib/DBIx/Class/Storage/DBI/MSSQL.pm +++ b/lib/DBIx/Class/Storage/DBI/MSSQL.pm @@ -41,6 +41,8 @@ sub insert_bulk { } } +# support MSSQL GUID column types + sub insert { my $self = shift; my ($source, $to_insert) = @_; @@ -127,9 +129,10 @@ sub _fetch_identity { my ($identity) = $sth->fetchrow_array; $sth->finish; - if ((not defined $identity) && $self->_identity_method && - $self->_identity_method eq '@@identity') { - ($identity) = $self->_dbh->selectrow_array('select @@identity'); + if ((not defined $identity) && $self->_identity_method) + ($identity) = $self->_dbh->selectrow_array( + 'select ' . $self->_identity_method + ); } return $identity; diff --git a/lib/DBIx/Class/Storage/DBI/Sybase/Base.pm b/lib/DBIx/Class/Storage/DBI/Sybase/Base.pm index af2a98f..5a98813 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase/Base.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase/Base.pm @@ -35,6 +35,7 @@ sub _placeholders_supported { # There's also $dbh->{syb_dynamic_supported} but it can be inaccurate for this # purpose. local $dbh->{PrintError} = 0; + local $dbh->{RaiseError} = 1; # this specifically tests a bind that is NOT a string $dbh->selectrow_array('select 1 where 1 = ?', {}, 1); }; diff --git a/t/lib/DBICTest/Schema/ArtistGUID.pm b/t/lib/DBICTest/Schema/ArtistGUID.pm new file mode 100644 index 0000000..cad8965 --- /dev/null +++ b/t/lib/DBICTest/Schema/ArtistGUID.pm @@ -0,0 +1,35 @@ +package # hide from PAUSE + DBICTest::Schema::ArtistGUID; + +use base qw/DBICTest::BaseResult/; + +# test MSSQL uniqueidentifier type + +__PACKAGE__->table('artist'); +__PACKAGE__->add_columns( + 'artistid' => { + data_type => 'uniqueidentifier' # auto_nextval not necessary for PK + }, + 'name' => { + data_type => 'varchar', + size => 100, + is_nullable => 1, + }, + rank => { + data_type => 'integer', + default_value => 13, + }, + charfield => { + data_type => 'char', + size => 10, + is_nullable => 1, + }, + a_guid => { + data_type => 'uniqueidentifier', + auto_nextval => 1, # necessary here, because not a PK + is_nullable => 1, + } +); +__PACKAGE__->set_primary_key('artistid'); + +1;