Skip to content
Browse files

wrap sqlite inserts in transaction to improve performance

  • Loading branch information...
1 parent 25c3705 commit f49e7d6cac20d8643b229ba61ac84379203dca44 @ryanb ryanb committed Aug 30, 2008
Showing with 7 additions and 1 deletion.
  1. +2 −0 CHANGELOG
  2. +5 −1 lib/populator/adapters/sqlite.rb
View
2 CHANGELOG
@@ -1,3 +1,5 @@
+* wrap sqlite inserts in transaction to improve performance
+
* default created_at/on and updated_at/on columns to current time
*0.2.0* (August 30th, 2008)
View
6 lib/populator/adapters/sqlite.rb
@@ -3,7 +3,11 @@ module Adapters
module Sqlite
# Executes multiple SQL statements in one query when joined with ";"
def execute_batch(sql, name = nil)
- catch_schema_changes { log(sql, name) { @connection.execute_batch(sql) } }
+ catch_schema_changes do
+ log(sql, name) do
+ @connection.transaction { |db| db.execute_batch(sql) }
+ end
+ end
end
def populate(table, columns, rows, name = nil)

0 comments on commit f49e7d6

Please sign in to comment.
Something went wrong with that request. Please try again.