[Bps-public-commit] r13748 - in DBIx-SearchBuilder/trunk: . SearchBuilder/Handle
sartak at bestpractical.com
sartak at bestpractical.com
Wed Jul 2 23:08:10 EDT 2008
Author: sartak
Date: Wed Jul 2 23:08:10 2008
New Revision: 13748
Modified:
DBIx-SearchBuilder/trunk/ (props changed)
DBIx-SearchBuilder/trunk/SearchBuilder/Handle.pm
DBIx-SearchBuilder/trunk/SearchBuilder/Handle/SQLite.pm
Log:
r63644 at onn: sartak | 2008-07-02 23:08:06 -0400
Flush the cache on any rollback, not just in SQLite
Modified: DBIx-SearchBuilder/trunk/SearchBuilder/Handle.pm
==============================================================================
--- DBIx-SearchBuilder/trunk/SearchBuilder/Handle.pm (original)
+++ DBIx-SearchBuilder/trunk/SearchBuilder/Handle.pm Wed Jul 2 23:08:10 2008
@@ -755,8 +755,15 @@
$self->TransactionDepth( $depth );
return 1 if $depth;
- return $self->dbh->rollback unless $action eq 'commit';
- return $self->dbh->commit;
+
+ if ($action eq 'commit') {
+ return $self->dbh->commit;
+ }
+ else {
+ DBIx::SearchBuilder::Record::Cachable->FlushCache
+ if DBIx::SearchBuilder::Record::Cachable->can('FlushCache');
+ return $self->dbh->rollback;
+ }
}
=head3 Commit [FORCE]
Modified: DBIx-SearchBuilder/trunk/SearchBuilder/Handle/SQLite.pm
==============================================================================
--- DBIx-SearchBuilder/trunk/SearchBuilder/Handle/SQLite.pm (original)
+++ DBIx-SearchBuilder/trunk/SearchBuilder/Handle/SQLite.pm Wed Jul 2 23:08:10 2008
@@ -132,37 +132,6 @@
$$statementref = "SELECT count(*) FROM (SELECT DISTINCT main.id FROM $$statementref )";
}
-=head3 EndTransaction [Action => 'commit'] [Force => 0]
-
-Tells to end the current transaction. Takes C<Action> argument
-that could be C<commit> or C<rollback>, the default value
-is C<commit>.
-
-If C<Force> argument is true then all nested transactions
-would be committed or rolled back.
-
-If there is no transaction in progress then method throw
-warning unless action is forced.
-
-Method returns true on success or false if error occured.
-
-Rolling back a SQLite transaction flushes the Record::Cachable cache because
-the primarily keys are reused, unlike many other database systems.
-
-=cut
-
-sub EndTransaction {
- my $self = shift;
- my %args = (Action => 'commit', @_);
- my $action = lc $args{'Action'} eq 'commit' ? 'commit': 'rollback';
-
- DBIx::SearchBuilder::Record::Cachable->FlushCache
- if $action eq 'rollback'
- && DBIx::SearchBuilder::Record::Cachable->can('FlushCache');
-
- $self->SUPER::EndTransaction(@_);
-}
-
1;
__END__
More information about the Bps-public-commit
mailing list