baza 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/baza.gemspec +1 -1
  3. data/include/query_buffer.rb +6 -7
  4. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "baza"
8
- s.version = "0.0.5"
8
+ s.version = "0.0.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kasper Johansen"]
@@ -47,7 +47,6 @@ class Baza::QueryBuffer
47
47
  def update(table, update, terms)
48
48
  STDOUT.puts "Update called on table #{table}." if @debug
49
49
  self.query(@args[:db].update(table, update, terms, :return_sql => true))
50
- self.flush if @queries_count >= 1000
51
50
  return nil
52
51
  end
53
52
 
@@ -56,7 +55,6 @@ class Baza::QueryBuffer
56
55
  # buffer.upsert(:users, {:id => 5}, {:name => "Kasper"})
57
56
  def upsert(table, data, terms)
58
57
  @args[:db].upsert(table, data, terms, :buffer => self)
59
- self.flush if @queries_count >= 1000
60
58
  return nil
61
59
  end
62
60
 
@@ -65,7 +63,6 @@ class Baza::QueryBuffer
65
63
  # buffer.insert(:users, {:name => "John Doe"})
66
64
  def insert(table, data)
67
65
  self.query(@args[:db].insert(table, data, :return_sql => true))
68
- self.flush if @queries_count >= 1000
69
66
  return nil
70
67
  end
71
68
 
@@ -75,10 +72,12 @@ class Baza::QueryBuffer
75
72
 
76
73
  @lock.synchronize do
77
74
  if !@queries.empty?
78
- @args[:db].transaction do
79
- @queries.shift(1000).each do |str|
80
- STDOUT.print "Executing via buffer: #{str}\n" if @debug
81
- @args[:db].q(str)
75
+ while !@queries.empty?
76
+ @args[:db].transaction do
77
+ @queries.shift(1000).each do |str|
78
+ STDOUT.print "Executing via buffer: #{str}\n" if @debug
79
+ @args[:db].q(str)
80
+ end
82
81
  end
83
82
  end
84
83
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baza
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -235,7 +235,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
235
235
  version: '0'
236
236
  segments:
237
237
  - 0
238
- hash: -3065201151015911898
238
+ hash: 1450717990956176451
239
239
  required_rubygems_version: !ruby/object:Gem::Requirement
240
240
  none: false
241
241
  requirements: