downpour 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,10 +25,23 @@ static VALUE is_buffered(VALUE self)
25
25
  return is_buffered_bool(self) ? Qtrue : Qfalse;
26
26
  }
27
27
 
28
+ static void raise_if_buffering_is_not_allowed(VALUE self)
29
+ {
30
+ if(RTEST(rb_iv_get(self, "@cannot_buffer")))
31
+ rb_raise(rb_eIOError, "cannot buffer after reading a row");
32
+ }
33
+
34
+ static void disallow_buffering(VALUE self)
35
+ {
36
+ rb_iv_set(self, "@cannot_buffer", Qtrue);
37
+ }
38
+
28
39
  static VALUE buffer_if_needed(VALUE self)
29
40
  {
30
41
  read_self_ptr();
31
42
 
43
+ raise_if_buffering_is_not_allowed(self);
44
+
32
45
  // Only buffer once
33
46
  if(is_buffered_bool(self))
34
47
  return Qfalse;
@@ -88,6 +101,8 @@ static VALUE next_row(VALUE self)
88
101
  {
89
102
  read_self_ptr();
90
103
 
104
+ disallow_buffering(self);
105
+
91
106
  if(is_buffered_bool(self))
92
107
  return next_row_buffered(self_ptr);
93
108
 
@@ -1,3 +1,3 @@
1
1
  module Downpour
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -18,6 +18,14 @@ describe "downpour connections" do
18
18
  it "should only accept a string as query" do
19
19
  lambda {@connection.query 42}.should raise_error(TypeError)
20
20
  end
21
+
22
+ it "should throw error if you try to read a row then buffer" do
23
+ lambda do
24
+ q = @connection.query "select * from Test1"
25
+ q.next_row
26
+ q.buffer!
27
+ end.should raise_error(IOError)
28
+ end
21
29
  end
22
30
 
23
31
  context "simple attributes" do
metadata CHANGED
@@ -1,48 +1,49 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: downpour
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.6
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 0.0.7
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Tejas Dinkar
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-06-03 00:00:00.000000000 +00:00
12
+
13
+ date: 2011-06-03 00:00:00 +05:30
13
14
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
16
17
  name: rake-compiler
17
- requirement: &18332580 !ruby/object:Gem::Requirement
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
18
20
  none: false
19
- requirements:
21
+ requirements:
20
22
  - - ~>
21
- - !ruby/object:Gem::Version
23
+ - !ruby/object:Gem::Version
22
24
  version: 0.7.1
23
25
  type: :development
24
- prerelease: false
25
- version_requirements: *18332580
26
- - !ruby/object:Gem::Dependency
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
27
28
  name: rspec
28
- requirement: &18330100 !ruby/object:Gem::Requirement
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
29
31
  none: false
30
- requirements:
31
- - - ! '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: "0"
34
36
  type: :development
35
- prerelease: false
36
- version_requirements: *18330100
37
- description: A simple, fast Mysql and Drizzle library for Ruby, binding to libdrizzle.
38
- Still in early alpha
37
+ version_requirements: *id002
38
+ description: A simple, fast Mysql and Drizzle library for Ruby, binding to libdrizzle. Still in early alpha
39
39
  email: tejas@gja.in
40
40
  executables: []
41
- extensions:
41
+
42
+ extensions:
42
43
  - ext/downpour/extconf.rb
43
- extra_rdoc_files:
44
+ extra_rdoc_files:
44
45
  - README.rdoc
45
- files:
46
+ files:
46
47
  - downpour.gemspec
47
48
  - ext/downpour/connection.c
48
49
  - ext/downpour/downpour.c
@@ -70,31 +71,33 @@ files:
70
71
  has_rdoc: true
71
72
  homepage: http://github.com/gja/downpour
72
73
  licenses: []
74
+
73
75
  post_install_message:
74
- rdoc_options:
76
+ rdoc_options:
75
77
  - --charset=UTF-8
76
- require_paths:
78
+ require_paths:
77
79
  - lib
78
80
  - ext
79
- required_ruby_version: !ruby/object:Gem::Requirement
81
+ required_ruby_version: !ruby/object:Gem::Requirement
80
82
  none: false
81
- requirements:
82
- - - ! '>='
83
- - !ruby/object:Gem::Version
84
- version: '0'
85
- required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: "0"
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
88
  none: false
87
- requirements:
88
- - - ! '>='
89
- - !ruby/object:Gem::Version
90
- version: '0'
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: "0"
91
93
  requirements: []
94
+
92
95
  rubyforge_project:
93
96
  rubygems_version: 1.6.2
94
97
  signing_key:
95
98
  specification_version: 3
96
99
  summary: A simple, fast Mysql and Drizzle library for Ruby, binding to libdrizzle
97
- test_files:
100
+ test_files:
98
101
  - spec/bootstrap.sql
99
102
  - spec/downpour/concurrent_spec.rb
100
103
  - spec/downpour/connect_type_spec.rb