Really fix SQLite savepoints unlike the shortsighted 398215b1
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / SQLite.pm
index 4311bdf..5acf261 100644 (file)
@@ -123,22 +123,17 @@ sub _exec_svp_rollback {
   my ($self, $name) = @_;
 
   $self->_dbh->do("ROLLBACK TO SAVEPOINT $name");
-}
-
-# older SQLite has issues here too - both of these are in fact
-# completely benign warnings (or at least so say the tests)
-sub _exec_txn_rollback {
-  local $SIG{__WARN__} = sigwarn_silencer( qr/rollback ineffective/ )
-    unless $DBD::SQLite::__DBIC_TXN_SYNC_SANE__;
-
-  shift->next::method(@_);
-}
-
-sub _exec_txn_commit {
-  local $SIG{__WARN__} = sigwarn_silencer( qr/commit ineffective/ )
-    unless $DBD::SQLite::__DBIC_TXN_SYNC_SANE__;
 
-  shift->next::method(@_);
+  # resync state for older DBD::SQLite (RT#67843)
+  # https://github.com/DBD-SQLite/DBD-SQLite/commit/9b3cdbf
+  if (
+    ! modver_gt_or_eq('DBD::SQLite', '1.33')
+      and
+    $self->_dbh->FETCH('AutoCommit')
+  ) {
+    $self->_dbh->STORE('AutoCommit', 0);
+    $self->_dbh->STORE('BegunWork', 1);
+  }
 }
 
 sub _ping {