aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-01-09 15:01:04 +0000
committerAaron Patterson <aaron.patterson@gmail.com>2011-01-11 13:45:07 -0800
commit29452abb846c74299a23d510b394768fe6dec47c (patch)
tree9d5609f8da33150532665a9dd142b4d950ee80c7 /activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
parent7f7b480098fa780dd76b4c1243230d74be67b3ca (diff)
downloadrails-29452abb846c74299a23d510b394768fe6dec47c.tar.gz
rails-29452abb846c74299a23d510b394768fe6dec47c.tar.bz2
rails-29452abb846c74299a23d510b394768fe6dec47c.zip
SQLite3 has supported savepoints since version 3.6.8, we should use this!
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
index bf599a95f7..b04383d5bf 100644
--- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
@@ -62,6 +62,10 @@ module ActiveRecord
sqlite_version >= '2.0.0'
end
+ def supports_savepoints?
+ sqlite_version >= '3.6.8'
+ end
+
# Returns +true+ when the connection adapter supports prepared statement
# caching, otherwise returns +false+
def supports_statement_cache?
@@ -189,6 +193,18 @@ module ActiveRecord
exec_query(sql, name).rows
end
+ def create_savepoint
+ execute("SAVEPOINT #{current_savepoint_name}")
+ end
+
+ def rollback_to_savepoint
+ execute("ROLLBACK TO SAVEPOINT #{current_savepoint_name}")
+ end
+
+ def release_savepoint
+ execute("RELEASE SAVEPOINT #{current_savepoint_name}")
+ end
+
def begin_db_transaction #:nodoc:
@connection.transaction
end