]>
Commit | Line | Data |
---|---|---|
fb7986e1 | 1 | diff -Nur sqlite3-ruby-1.2.4.orig/lib/sqlite3/database.rb sqlite3-ruby-1.2.4.threadmutex/lib/sqlite3/database.rb |
2 | --- sqlite3-ruby-1.2.4.orig/lib/sqlite3/database.rb 2008-06-26 07:52:02.000000000 -0600 | |
3 | +++ sqlite3-ruby-1.2.4.threadmutex/lib/sqlite3/database.rb 2008-08-30 10:44:55.000000000 -0600 | |
4 | @@ -4,6 +4,7 @@ | |
5 | require 'sqlite3/statement' | |
6 | require 'sqlite3/translator' | |
7 | require 'sqlite3/value' | |
8 | +require 'thread' | |
9 | ||
10 | module SQLite3 | |
11 | ||
12 | @@ -82,6 +83,7 @@ | |
13 | @results_as_hash = options.fetch(:results_as_hash,false) | |
14 | @type_translation = options.fetch(:type_translation,false) | |
15 | @translator = nil | |
16 | + @transaction_mutex = Mutex.new | |
17 | @transaction_active = false | |
18 | end | |
19 | ||
20 | @@ -151,6 +153,7 @@ | |
21 | # The Statement can then be executed using Statement#execute. | |
22 | # | |
23 | def prepare( sql ) | |
24 | + @transaction_mutex.synchronize do | |
25 | stmt = @statement_factory.new( self, sql ) | |
26 | if block_given? | |
27 | begin | |
28 | @@ -161,6 +164,7 @@ | |
29 | else | |
30 | return stmt | |
31 | end | |
32 | + end | |
33 | end | |
34 | ||
35 | # Executes the given SQL statement. If additional parameters are given, |