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');
}
}
+# support MSSQL GUID column types
+
sub insert {
my $self = shift;
my ($source, $to_insert) = @_;
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;
# 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);
};
--- /dev/null
+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;