[Bast-commits] r7151 - in DBIx-Class/0.08/branches/mssql_storage_minor_refactor: lib/DBIx/Class/Storage lib/DBIx/Class/Storage/DBI lib/DBIx/Class/Storage/DBI/Sybase t/lib/DBICTest/Schema

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Thu Jul 30 16:57:23 GMT 2009


Author: caelum
Date: 2009-07-30 16:57:22 +0000 (Thu, 30 Jul 2009)
New Revision: 7151

Added:
   DBIx-Class/0.08/branches/mssql_storage_minor_refactor/t/lib/DBICTest/Schema/ArtistGUID.pm
Modified:
   DBIx-Class/0.08/branches/mssql_storage_minor_refactor/lib/DBIx/Class/Storage/DBI.pm
   DBIx-Class/0.08/branches/mssql_storage_minor_refactor/lib/DBIx/Class/Storage/DBI/MSSQL.pm
   DBIx-Class/0.08/branches/mssql_storage_minor_refactor/lib/DBIx/Class/Storage/DBI/Sybase/Base.pm
Log:
add missing file

Modified: DBIx-Class/0.08/branches/mssql_storage_minor_refactor/lib/DBIx/Class/Storage/DBI/MSSQL.pm
===================================================================
--- DBIx-Class/0.08/branches/mssql_storage_minor_refactor/lib/DBIx/Class/Storage/DBI/MSSQL.pm	2009-07-30 16:04:47 UTC (rev 7150)
+++ DBIx-Class/0.08/branches/mssql_storage_minor_refactor/lib/DBIx/Class/Storage/DBI/MSSQL.pm	2009-07-30 16:57:22 UTC (rev 7151)
@@ -41,6 +41,8 @@
   }
 }
 
+# support MSSQL GUID column types
+
 sub insert {
   my $self = shift;
   my ($source, $to_insert) = @_;
@@ -127,9 +129,10 @@
   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;

Modified: DBIx-Class/0.08/branches/mssql_storage_minor_refactor/lib/DBIx/Class/Storage/DBI/Sybase/Base.pm
===================================================================
--- DBIx-Class/0.08/branches/mssql_storage_minor_refactor/lib/DBIx/Class/Storage/DBI/Sybase/Base.pm	2009-07-30 16:04:47 UTC (rev 7150)
+++ DBIx-Class/0.08/branches/mssql_storage_minor_refactor/lib/DBIx/Class/Storage/DBI/Sybase/Base.pm	2009-07-30 16:57:22 UTC (rev 7151)
@@ -35,6 +35,7 @@
 # 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);
   };

Modified: DBIx-Class/0.08/branches/mssql_storage_minor_refactor/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/branches/mssql_storage_minor_refactor/lib/DBIx/Class/Storage/DBI.pm	2009-07-30 16:04:47 UTC (rev 7150)
+++ DBIx-Class/0.08/branches/mssql_storage_minor_refactor/lib/DBIx/Class/Storage/DBI.pm	2009-07-30 16:57:22 UTC (rev 7151)
@@ -1144,6 +1144,7 @@
 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');

Added: DBIx-Class/0.08/branches/mssql_storage_minor_refactor/t/lib/DBICTest/Schema/ArtistGUID.pm
===================================================================
--- DBIx-Class/0.08/branches/mssql_storage_minor_refactor/t/lib/DBICTest/Schema/ArtistGUID.pm	                        (rev 0)
+++ DBIx-Class/0.08/branches/mssql_storage_minor_refactor/t/lib/DBICTest/Schema/ArtistGUID.pm	2009-07-30 16:57:22 UTC (rev 7151)
@@ -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;




More information about the Bast-commits mailing list