sqlite3-ruby 1.2.5-x86-mswin32 → 1.3.0.beta.1-x86-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/API_CHANGES.rdoc +48 -0
- data/{History.txt → CHANGELOG.rdoc} +24 -0
- data/Manifest.txt +14 -14
- data/{README.txt → README.rdoc} +1 -6
- data/Rakefile +8 -3
- data/ext/sqlite3/database.c +687 -0
- data/ext/sqlite3/database.h +15 -0
- data/ext/sqlite3/exception.c +94 -0
- data/ext/sqlite3/exception.h +8 -0
- data/ext/sqlite3/extconf.rb +26 -0
- data/ext/sqlite3/sqlite3.c +33 -0
- data/ext/sqlite3/sqlite3_ruby.h +43 -0
- data/ext/sqlite3/statement.c +412 -0
- data/ext/sqlite3/statement.h +16 -0
- data/lib/sqlite3.rb +9 -0
- data/lib/sqlite3/1.8/sqlite3_native.so +0 -0
- data/lib/sqlite3/1.9/sqlite3_native.so +0 -0
- data/lib/sqlite3/database.rb +94 -302
- data/lib/sqlite3/errors.rb +0 -24
- data/lib/sqlite3/pragmas.rb +16 -7
- data/lib/sqlite3/resultset.rb +25 -81
- data/lib/sqlite3/statement.rb +22 -107
- data/lib/sqlite3/version.rb +4 -4
- data/setup.rb +2 -2
- data/tasks/native.rake +13 -17
- data/tasks/vendor_sqlite3.rake +10 -7
- data/test/helper.rb +1 -65
- data/test/test_database.rb +239 -189
- data/test/test_encoding.rb +115 -0
- data/test/test_integration.rb +38 -35
- data/test/test_integration_open_close.rb +1 -1
- data/test/test_integration_pending.rb +6 -4
- data/test/test_integration_resultset.rb +20 -8
- data/test/test_integration_statement.rb +1 -2
- data/test/test_sqlite3.rb +9 -0
- data/test/test_statement.rb +193 -0
- metadata +84 -49
- data/ext/sqlite3_api/extconf.rb +0 -10
- data/ext/sqlite3_api/sqlite3_api.i +0 -362
- data/ext/sqlite3_api/sqlite3_api_wrap.c +0 -5018
- data/lib/1.8/sqlite3_api.so +0 -0
- data/lib/1.9/sqlite3_api.so +0 -0
- data/lib/sqlite3/driver/dl/api.rb +0 -152
- data/lib/sqlite3/driver/dl/driver.rb +0 -307
- data/lib/sqlite3/driver/native/driver.rb +0 -219
- data/tasks/benchmark.rake +0 -9
- data/tasks/gem.rake +0 -32
- data/test/bm.rb +0 -140
- data/test/driver/dl/tc_driver.rb +0 -292
- data/test/native-vs-dl.rb +0 -126
- data/test/test_errors.rb +0 -17
@@ -2,7 +2,7 @@ require File.join(File.dirname(__FILE__), 'helper')
|
|
2
2
|
|
3
3
|
class TC_Statement < Test::Unit::TestCase
|
4
4
|
def setup
|
5
|
-
@db = SQLite3::Database.new(
|
5
|
+
@db = SQLite3::Database.new(":memory:")
|
6
6
|
@db.transaction do
|
7
7
|
@db.execute "create table foo ( a integer primary key, b text )"
|
8
8
|
@db.execute "insert into foo ( b ) values ( 'foo' )"
|
@@ -15,7 +15,6 @@ class TC_Statement < Test::Unit::TestCase
|
|
15
15
|
def teardown
|
16
16
|
@stmt.close
|
17
17
|
@db.close
|
18
|
-
File.delete( "test.db" )
|
19
18
|
end
|
20
19
|
|
21
20
|
def test_remainder_empty
|
@@ -0,0 +1,193 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
module SQLite3
|
4
|
+
class TestStatement < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
@db = SQLite3::Database.new(':memory:')
|
7
|
+
@stmt = SQLite3::Statement.new(@db, "select 'foo'")
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_database_name
|
11
|
+
@db.execute('create table foo(text BLOB)')
|
12
|
+
@db.execute('insert into foo(text) values (?)',SQLite3::Blob.new('hello'))
|
13
|
+
stmt = @db.prepare('select text from foo')
|
14
|
+
assert_equal 'main', stmt.database_name(0)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_prepare_blob
|
18
|
+
@db.execute('create table foo(text BLOB)')
|
19
|
+
stmt = @db.prepare('insert into foo(text) values (?)')
|
20
|
+
stmt.bind_param(1, SQLite3::Blob.new('hello'))
|
21
|
+
stmt.step
|
22
|
+
stmt.close
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_select_blob
|
26
|
+
@db.execute('create table foo(text BLOB)')
|
27
|
+
@db.execute('insert into foo(text) values (?)',SQLite3::Blob.new('hello'))
|
28
|
+
assert_equal 'hello', @db.execute('select * from foo').first.first
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_new
|
32
|
+
assert @stmt
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_new_closed_handle
|
36
|
+
@db = SQLite3::Database.new(':memory:')
|
37
|
+
@db.close
|
38
|
+
assert_raises(ArgumentError) do
|
39
|
+
SQLite3::Statement.new(@db, 'select "foo"')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_new_with_remainder
|
44
|
+
stmt = SQLite3::Statement.new(@db, "select 'foo';bar")
|
45
|
+
assert_equal 'bar', stmt.remainder
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_empty_remainder
|
49
|
+
assert_equal '', @stmt.remainder
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_close
|
53
|
+
@stmt.close
|
54
|
+
assert @stmt.closed?
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_double_close
|
58
|
+
@stmt.close
|
59
|
+
assert_raises(SQLite3::Exception) do
|
60
|
+
@stmt.close
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_bind_param_string
|
65
|
+
stmt = SQLite3::Statement.new(@db, "select ?")
|
66
|
+
stmt.bind_param(1, "hello")
|
67
|
+
result = nil
|
68
|
+
stmt.each { |x| result = x }
|
69
|
+
assert_equal ['hello'], result
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_bind_param_int
|
73
|
+
stmt = SQLite3::Statement.new(@db, "select ?")
|
74
|
+
stmt.bind_param(1, 10)
|
75
|
+
result = nil
|
76
|
+
stmt.each { |x| result = x }
|
77
|
+
assert_equal [10], result
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_bind_nil
|
81
|
+
stmt = SQLite3::Statement.new(@db, "select ?")
|
82
|
+
stmt.bind_param(1, nil)
|
83
|
+
result = nil
|
84
|
+
stmt.each { |x| result = x }
|
85
|
+
assert_equal [nil], result
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_bind_blobs
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_bind_64
|
92
|
+
stmt = SQLite3::Statement.new(@db, "select ?")
|
93
|
+
stmt.bind_param(1, 2 ** 31)
|
94
|
+
result = nil
|
95
|
+
stmt.each { |x| result = x }
|
96
|
+
assert_equal [2 ** 31], result
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_bind_double
|
100
|
+
stmt = SQLite3::Statement.new(@db, "select ?")
|
101
|
+
stmt.bind_param(1, 2.2)
|
102
|
+
result = nil
|
103
|
+
stmt.each { |x| result = x }
|
104
|
+
assert_equal [2.2], result
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_named_bind
|
108
|
+
stmt = SQLite3::Statement.new(@db, "select :foo")
|
109
|
+
stmt.bind_param(':foo', 'hello')
|
110
|
+
result = nil
|
111
|
+
stmt.each { |x| result = x }
|
112
|
+
assert_equal ['hello'], result
|
113
|
+
end
|
114
|
+
|
115
|
+
def test_named_bind_no_colon
|
116
|
+
stmt = SQLite3::Statement.new(@db, "select :foo")
|
117
|
+
stmt.bind_param('foo', 'hello')
|
118
|
+
result = nil
|
119
|
+
stmt.each { |x| result = x }
|
120
|
+
assert_equal ['hello'], result
|
121
|
+
end
|
122
|
+
|
123
|
+
def test_named_bind_symbol
|
124
|
+
stmt = SQLite3::Statement.new(@db, "select :foo")
|
125
|
+
stmt.bind_param(:foo, 'hello')
|
126
|
+
result = nil
|
127
|
+
stmt.each { |x| result = x }
|
128
|
+
assert_equal ['hello'], result
|
129
|
+
end
|
130
|
+
|
131
|
+
def test_named_bind_not_found
|
132
|
+
stmt = SQLite3::Statement.new(@db, "select :foo")
|
133
|
+
assert_raises(SQLite3::Exception) do
|
134
|
+
stmt.bind_param('bar', 'hello')
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_each
|
139
|
+
r = nil
|
140
|
+
@stmt.each do |row|
|
141
|
+
r = row
|
142
|
+
end
|
143
|
+
assert_equal(['foo'], r)
|
144
|
+
end
|
145
|
+
|
146
|
+
def test_reset!
|
147
|
+
r = []
|
148
|
+
@stmt.each { |row| r << row }
|
149
|
+
@stmt.reset!
|
150
|
+
@stmt.each { |row| r << row }
|
151
|
+
assert_equal [['foo'], ['foo']], r
|
152
|
+
end
|
153
|
+
|
154
|
+
def test_step
|
155
|
+
r = @stmt.step
|
156
|
+
assert_equal ['foo'], r
|
157
|
+
end
|
158
|
+
|
159
|
+
def test_tainted
|
160
|
+
r = @stmt.step
|
161
|
+
assert r.first.tainted?
|
162
|
+
end
|
163
|
+
|
164
|
+
def test_step_twice
|
165
|
+
assert_not_nil @stmt.step
|
166
|
+
assert !@stmt.done?
|
167
|
+
assert_nil @stmt.step
|
168
|
+
assert @stmt.done?
|
169
|
+
|
170
|
+
@stmt.reset!
|
171
|
+
assert !@stmt.done?
|
172
|
+
end
|
173
|
+
|
174
|
+
def test_step_never_moves_past_done
|
175
|
+
10.times { @stmt.step }
|
176
|
+
@stmt.done?
|
177
|
+
end
|
178
|
+
|
179
|
+
def test_column_count
|
180
|
+
assert_equal 1, @stmt.column_count
|
181
|
+
end
|
182
|
+
|
183
|
+
def test_column_name
|
184
|
+
assert_equal "'foo'", @stmt.column_name(0)
|
185
|
+
assert_equal nil, @stmt.column_name(10)
|
186
|
+
end
|
187
|
+
|
188
|
+
def test_bind_parameter_count
|
189
|
+
stmt = SQLite3::Statement.new(@db, "select ?, ?, ?")
|
190
|
+
assert_equal 3, stmt.bind_parameter_count
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
metadata
CHANGED
@@ -1,47 +1,68 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sqlite3-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: true
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 3
|
8
|
+
- 0
|
9
|
+
- beta
|
10
|
+
- 1
|
11
|
+
version: 1.3.0.beta.1
|
5
12
|
platform: x86-mswin32
|
6
13
|
authors:
|
7
14
|
- Jamis Buck
|
15
|
+
- Luis Lavena
|
16
|
+
- Aaron Patterson
|
8
17
|
autorequire:
|
9
18
|
bindir: bin
|
10
19
|
cert_chain: []
|
11
20
|
|
12
|
-
date:
|
21
|
+
date: 2010-05-10 00:00:00 -03:00
|
13
22
|
default_executable:
|
14
23
|
dependencies:
|
15
24
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
name: rubyforge
|
26
|
+
prerelease: false
|
27
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
28
|
requirements:
|
21
29
|
- - ">="
|
22
30
|
- !ruby/object:Gem::Version
|
23
|
-
|
24
|
-
|
31
|
+
segments:
|
32
|
+
- 2
|
33
|
+
- 0
|
34
|
+
- 4
|
35
|
+
version: 2.0.4
|
36
|
+
type: :development
|
37
|
+
version_requirements: *id001
|
25
38
|
- !ruby/object:Gem::Dependency
|
26
39
|
name: rake-compiler
|
27
|
-
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
42
|
requirements:
|
31
43
|
- - ~>
|
32
44
|
- !ruby/object:Gem::Version
|
33
|
-
|
34
|
-
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
- 7
|
48
|
+
- 0
|
49
|
+
version: 0.7.0
|
50
|
+
type: :development
|
51
|
+
version_requirements: *id002
|
35
52
|
- !ruby/object:Gem::Dependency
|
36
53
|
name: hoe
|
37
|
-
|
38
|
-
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
prerelease: false
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
56
|
requirements:
|
41
57
|
- - ">="
|
42
58
|
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
|
59
|
+
segments:
|
60
|
+
- 2
|
61
|
+
- 6
|
62
|
+
- 0
|
63
|
+
version: 2.6.0
|
64
|
+
type: :development
|
65
|
+
version_requirements: *id003
|
45
66
|
description: |-
|
46
67
|
This module allows Ruby programs to interface with the SQLite3
|
47
68
|
database engine (http://www.sqlite.org). You must have the
|
@@ -50,32 +71,43 @@ description: |-
|
|
50
71
|
Note that this module is NOT compatible with SQLite 2.x.
|
51
72
|
email:
|
52
73
|
- jamis@37signals.com
|
74
|
+
- luislavena@gmail.com
|
75
|
+
- aaron@tenderlovemaking.com
|
53
76
|
executables: []
|
54
77
|
|
55
78
|
extensions: []
|
56
79
|
|
57
80
|
extra_rdoc_files:
|
58
|
-
- History.txt
|
59
81
|
- Manifest.txt
|
60
|
-
-
|
82
|
+
- API_CHANGES.rdoc
|
83
|
+
- README.rdoc
|
84
|
+
- CHANGELOG.rdoc
|
85
|
+
- ext/sqlite3/database.c
|
86
|
+
- ext/sqlite3/statement.c
|
87
|
+
- ext/sqlite3/sqlite3.c
|
88
|
+
- ext/sqlite3/exception.c
|
61
89
|
files:
|
90
|
+
- API_CHANGES.rdoc
|
91
|
+
- CHANGELOG.rdoc
|
62
92
|
- ChangeLog.cvs
|
63
|
-
- History.txt
|
64
93
|
- LICENSE
|
65
94
|
- Manifest.txt
|
66
|
-
- README.
|
95
|
+
- README.rdoc
|
67
96
|
- Rakefile
|
68
|
-
- ext/
|
69
|
-
- ext/
|
70
|
-
- ext/
|
97
|
+
- ext/sqlite3/database.c
|
98
|
+
- ext/sqlite3/database.h
|
99
|
+
- ext/sqlite3/exception.c
|
100
|
+
- ext/sqlite3/exception.h
|
101
|
+
- ext/sqlite3/extconf.rb
|
102
|
+
- ext/sqlite3/sqlite3.c
|
103
|
+
- ext/sqlite3/sqlite3_ruby.h
|
104
|
+
- ext/sqlite3/statement.c
|
105
|
+
- ext/sqlite3/statement.h
|
71
106
|
- faq/faq.rb
|
72
107
|
- faq/faq.yml
|
73
108
|
- lib/sqlite3.rb
|
74
109
|
- lib/sqlite3/constants.rb
|
75
110
|
- lib/sqlite3/database.rb
|
76
|
-
- lib/sqlite3/driver/dl/api.rb
|
77
|
-
- lib/sqlite3/driver/dl/driver.rb
|
78
|
-
- lib/sqlite3/driver/native/driver.rb
|
79
111
|
- lib/sqlite3/errors.rb
|
80
112
|
- lib/sqlite3/pragmas.rb
|
81
113
|
- lib/sqlite3/resultset.rb
|
@@ -84,24 +116,21 @@ files:
|
|
84
116
|
- lib/sqlite3/value.rb
|
85
117
|
- lib/sqlite3/version.rb
|
86
118
|
- setup.rb
|
87
|
-
- tasks/benchmark.rake
|
88
119
|
- tasks/faq.rake
|
89
|
-
- tasks/gem.rake
|
90
120
|
- tasks/native.rake
|
91
121
|
- tasks/vendor_sqlite3.rake
|
92
|
-
- test/bm.rb
|
93
|
-
- test/driver/dl/tc_driver.rb
|
94
122
|
- test/helper.rb
|
95
|
-
- test/native-vs-dl.rb
|
96
123
|
- test/test_database.rb
|
97
|
-
- test/test_errors.rb
|
98
124
|
- test/test_integration.rb
|
99
125
|
- test/test_integration_open_close.rb
|
100
126
|
- test/test_integration_pending.rb
|
101
127
|
- test/test_integration_resultset.rb
|
102
128
|
- test/test_integration_statement.rb
|
103
|
-
-
|
104
|
-
-
|
129
|
+
- test/test_sqlite3.rb
|
130
|
+
- test/test_statement.rb
|
131
|
+
- test/test_encoding.rb
|
132
|
+
- lib/sqlite3/1.8/sqlite3_native.so
|
133
|
+
- lib/sqlite3/1.9/sqlite3_native.so
|
105
134
|
has_rdoc: true
|
106
135
|
homepage: http://sqlite3-ruby.rubyforge.org
|
107
136
|
licenses: []
|
@@ -109,35 +138,41 @@ licenses: []
|
|
109
138
|
post_install_message:
|
110
139
|
rdoc_options:
|
111
140
|
- --main
|
112
|
-
- README.
|
113
|
-
- --main=README.txt
|
141
|
+
- README.rdoc
|
114
142
|
require_paths:
|
115
143
|
- lib
|
116
|
-
- ext
|
117
144
|
required_ruby_version: !ruby/object:Gem::Requirement
|
118
145
|
requirements:
|
119
|
-
- - "
|
146
|
+
- - ">="
|
120
147
|
- !ruby/object:Gem::Version
|
121
|
-
|
122
|
-
|
148
|
+
segments:
|
149
|
+
- 1
|
150
|
+
- 8
|
151
|
+
- 6
|
152
|
+
version: 1.8.6
|
123
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
154
|
requirements:
|
125
155
|
- - ">="
|
126
156
|
- !ruby/object:Gem::Version
|
127
|
-
|
128
|
-
|
157
|
+
segments:
|
158
|
+
- 1
|
159
|
+
- 3
|
160
|
+
- 5
|
161
|
+
version: 1.3.5
|
129
162
|
requirements: []
|
130
163
|
|
131
|
-
rubyforge_project:
|
132
|
-
rubygems_version: 1.3.
|
164
|
+
rubyforge_project: sqlite3-ruby
|
165
|
+
rubygems_version: 1.3.6
|
133
166
|
signing_key:
|
134
167
|
specification_version: 3
|
135
168
|
summary: This module allows Ruby programs to interface with the SQLite3 database engine (http://www.sqlite.org)
|
136
169
|
test_files:
|
170
|
+
- test/test_sqlite3.rb
|
171
|
+
- test/test_integration_open_close.rb
|
137
172
|
- test/test_database.rb
|
138
|
-
- test/test_errors.rb
|
139
173
|
- test/test_integration.rb
|
140
|
-
- test/
|
174
|
+
- test/test_statement.rb
|
141
175
|
- test/test_integration_pending.rb
|
142
|
-
- test/test_integration_resultset.rb
|
143
176
|
- test/test_integration_statement.rb
|
177
|
+
- test/test_encoding.rb
|
178
|
+
- test/test_integration_resultset.rb
|
data/ext/sqlite3_api/extconf.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
require 'mkmf'
|
2
|
-
|
3
|
-
dir_config( "sqlite3" )
|
4
|
-
|
5
|
-
have_library( "rt", "fdatasync" )
|
6
|
-
|
7
|
-
if have_header( "sqlite3.h" ) && have_library( "sqlite3", "sqlite3_open" ) then
|
8
|
-
$CFLAGS << " -fno-strict-aliasing" unless RUBY_PLATFORM =~ /mswin/
|
9
|
-
create_makefile( "sqlite3_api" )
|
10
|
-
end
|