Skip to content

Commit

Permalink
wrap sqlite inserts in transaction to improve performance
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanb committed Aug 30, 2008
1 parent 25c3705 commit f49e7d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions 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)
Expand Down
6 changes: 5 additions & 1 deletion lib/populator/adapters/sqlite.rb
Expand Up @@ -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)
Expand Down

0 comments on commit f49e7d6

Please sign in to comment.