[Bast-commits] r7148 - in
DBIx-Class/0.08/branches/mssql_storage_minor_refactor:
lib/DBIx/Class/Storage t
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Thu Jul 30 14:55:36 GMT 2009
Author: caelum
Date: 2009-07-30 14:55:35 +0000 (Thu, 30 Jul 2009)
New Revision: 7148
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/t/746mssql.t
Log:
better rebless check for insert
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 14:26:47 UTC (rev 7147)
+++ DBIx-Class/0.08/branches/mssql_storage_minor_refactor/lib/DBIx/Class/Storage/DBI.pm 2009-07-30 14:55:35 UTC (rev 7148)
@@ -15,8 +15,8 @@
use List::Util();
__PACKAGE__->mk_group_accessors('simple' =>
- qw/_connect_info _dbi_connect_info _dbh _sql_maker _sql_maker_opts
- _conn_pid _conn_tid transaction_depth _dbh_autocommit savepoints/
+ qw/_connect_info _dbi_connect_info _dbh _sql_maker _sql_maker_opts _conn_pid
+ _conn_tid transaction_depth _dbh_autocommit _driver_determined savepoints/
);
# the values for these accessors are picked out (and deleted) from
@@ -763,7 +763,7 @@
sub _determine_driver {
my ($self) = @_;
- if (ref $self eq 'DBIx::Class::Storage::DBI') {
+ if (not $self->_driver_determined) {
my $driver;
if ($self->_dbh) { # we are connected
@@ -780,6 +780,8 @@
bless $self, $storage_class;
$self->_rebless();
}
+
+ $self->_driver_determined(1);
}
}
@@ -1142,7 +1144,7 @@
sub insert {
my ($self, $source, $to_insert) = @_;
- if ((not $self->_dbh) && ref($self) eq __PACKAGE__) {
+ if (not $self->_driver_determined) {
$self->_determine_driver;
goto $self->can('insert');
}
Modified: DBIx-Class/0.08/branches/mssql_storage_minor_refactor/t/746mssql.t
===================================================================
--- DBIx-Class/0.08/branches/mssql_storage_minor_refactor/t/746mssql.t 2009-07-30 14:26:47 UTC (rev 7147)
+++ DBIx-Class/0.08/branches/mssql_storage_minor_refactor/t/746mssql.t 2009-07-30 14:55:35 UTC (rev 7148)
@@ -100,6 +100,9 @@
SQL
});
+# start disconnected to make sure insert works on an un-reblessed storage
+$schema = DBICTest::Schema->connect($dsn, $user, $pass);
+
my $row;
lives_ok {
$row = $schema->resultset('ArtistGUID')->create({ name => 'mtfnpy' })
More information about the Bast-commits
mailing list