sqlite3 1.3.3-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/API_CHANGES.rdoc +50 -0
  2. data/CHANGELOG.rdoc +177 -0
  3. data/ChangeLog.cvs +88 -0
  4. data/LICENSE +27 -0
  5. data/Manifest.txt +50 -0
  6. data/README.rdoc +103 -0
  7. data/Rakefile +10 -0
  8. data/ext/sqlite3/backup.c +164 -0
  9. data/ext/sqlite3/backup.h +15 -0
  10. data/ext/sqlite3/database.c +762 -0
  11. data/ext/sqlite3/database.h +15 -0
  12. data/ext/sqlite3/exception.c +94 -0
  13. data/ext/sqlite3/exception.h +8 -0
  14. data/ext/sqlite3/extconf.rb +47 -0
  15. data/ext/sqlite3/sqlite3.c +36 -0
  16. data/ext/sqlite3/sqlite3_ruby.h +44 -0
  17. data/ext/sqlite3/statement.c +419 -0
  18. data/ext/sqlite3/statement.h +16 -0
  19. data/faq/faq.rb +145 -0
  20. data/faq/faq.yml +426 -0
  21. data/lib/sqlite3.rb +10 -0
  22. data/lib/sqlite3/1.8/sqlite3_native.so +0 -0
  23. data/lib/sqlite3/1.9/sqlite3_native.so +0 -0
  24. data/lib/sqlite3/constants.rb +49 -0
  25. data/lib/sqlite3/database.rb +587 -0
  26. data/lib/sqlite3/errors.rb +44 -0
  27. data/lib/sqlite3/pragmas.rb +280 -0
  28. data/lib/sqlite3/resultset.rb +126 -0
  29. data/lib/sqlite3/statement.rb +148 -0
  30. data/lib/sqlite3/translator.rb +118 -0
  31. data/lib/sqlite3/value.rb +57 -0
  32. data/lib/sqlite3/version.rb +25 -0
  33. data/setup.rb +1333 -0
  34. data/tasks/faq.rake +9 -0
  35. data/tasks/gem.rake +31 -0
  36. data/tasks/native.rake +61 -0
  37. data/tasks/vendor_sqlite3.rake +104 -0
  38. data/test/helper.rb +3 -0
  39. data/test/test_backup.rb +33 -0
  40. data/test/test_collation.rb +82 -0
  41. data/test/test_database.rb +312 -0
  42. data/test/test_database_readonly.rb +29 -0
  43. data/test/test_deprecated.rb +37 -0
  44. data/test/test_encoding.rb +119 -0
  45. data/test/test_integration.rb +544 -0
  46. data/test/test_integration_open_close.rb +30 -0
  47. data/test/test_integration_pending.rb +115 -0
  48. data/test/test_integration_resultset.rb +156 -0
  49. data/test/test_integration_statement.rb +194 -0
  50. data/test/test_sqlite3.rb +9 -0
  51. data/test/test_statement.rb +207 -0
  52. data/test/test_statement_execute.rb +35 -0
  53. metadata +202 -0
@@ -0,0 +1,9 @@
1
+ require 'helper'
2
+
3
+ module SQLite3
4
+ class TestSQLite3 < Test::Unit::TestCase
5
+ def test_libversion
6
+ assert_not_nil SQLite3.libversion
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,207 @@
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
+ ###
11
+ # This method may not exist depending on how sqlite3 was compiled
12
+ def test_database_name
13
+ @db.execute('create table foo(text BLOB)')
14
+ @db.execute('insert into foo(text) values (?)',SQLite3::Blob.new('hello'))
15
+ stmt = @db.prepare('select text from foo')
16
+ if stmt.respond_to?(:database_name)
17
+ assert_equal 'main', stmt.database_name(0)
18
+ end
19
+ end
20
+
21
+ def test_prepare_blob
22
+ @db.execute('create table foo(text BLOB)')
23
+ stmt = @db.prepare('insert into foo(text) values (?)')
24
+ stmt.bind_param(1, SQLite3::Blob.new('hello'))
25
+ stmt.step
26
+ stmt.close
27
+ end
28
+
29
+ def test_select_blob
30
+ @db.execute('create table foo(text BLOB)')
31
+ @db.execute('insert into foo(text) values (?)',SQLite3::Blob.new('hello'))
32
+ assert_equal 'hello', @db.execute('select * from foo').first.first
33
+ end
34
+
35
+ def test_new
36
+ assert @stmt
37
+ end
38
+
39
+ def test_new_closed_handle
40
+ @db = SQLite3::Database.new(':memory:')
41
+ @db.close
42
+ assert_raises(ArgumentError) do
43
+ SQLite3::Statement.new(@db, 'select "foo"')
44
+ end
45
+ end
46
+
47
+ def test_new_with_remainder
48
+ stmt = SQLite3::Statement.new(@db, "select 'foo';bar")
49
+ assert_equal 'bar', stmt.remainder
50
+ end
51
+
52
+ def test_empty_remainder
53
+ assert_equal '', @stmt.remainder
54
+ end
55
+
56
+ def test_close
57
+ @stmt.close
58
+ assert @stmt.closed?
59
+ end
60
+
61
+ def test_double_close
62
+ @stmt.close
63
+ assert_raises(SQLite3::Exception) do
64
+ @stmt.close
65
+ end
66
+ end
67
+
68
+ def test_bind_param_string
69
+ stmt = SQLite3::Statement.new(@db, "select ?")
70
+ stmt.bind_param(1, "hello")
71
+ result = nil
72
+ stmt.each { |x| result = x }
73
+ assert_equal ['hello'], result
74
+ end
75
+
76
+ def test_bind_param_int
77
+ stmt = SQLite3::Statement.new(@db, "select ?")
78
+ stmt.bind_param(1, 10)
79
+ result = nil
80
+ stmt.each { |x| result = x }
81
+ assert_equal [10], result
82
+ end
83
+
84
+ def test_bind_nil
85
+ stmt = SQLite3::Statement.new(@db, "select ?")
86
+ stmt.bind_param(1, nil)
87
+ result = nil
88
+ stmt.each { |x| result = x }
89
+ assert_equal [nil], result
90
+ end
91
+
92
+ def test_bind_blobs
93
+ end
94
+
95
+ def test_bind_64
96
+ stmt = SQLite3::Statement.new(@db, "select ?")
97
+ stmt.bind_param(1, 2 ** 31)
98
+ result = nil
99
+ stmt.each { |x| result = x }
100
+ assert_equal [2 ** 31], result
101
+ end
102
+
103
+ def test_bind_double
104
+ stmt = SQLite3::Statement.new(@db, "select ?")
105
+ stmt.bind_param(1, 2.2)
106
+ result = nil
107
+ stmt.each { |x| result = x }
108
+ assert_equal [2.2], result
109
+ end
110
+
111
+ def test_named_bind
112
+ stmt = SQLite3::Statement.new(@db, "select :foo")
113
+ stmt.bind_param(':foo', 'hello')
114
+ result = nil
115
+ stmt.each { |x| result = x }
116
+ assert_equal ['hello'], result
117
+ end
118
+
119
+ def test_named_bind_no_colon
120
+ stmt = SQLite3::Statement.new(@db, "select :foo")
121
+ stmt.bind_param('foo', 'hello')
122
+ result = nil
123
+ stmt.each { |x| result = x }
124
+ assert_equal ['hello'], result
125
+ end
126
+
127
+ def test_named_bind_symbol
128
+ stmt = SQLite3::Statement.new(@db, "select :foo")
129
+ stmt.bind_param(:foo, 'hello')
130
+ result = nil
131
+ stmt.each { |x| result = x }
132
+ assert_equal ['hello'], result
133
+ end
134
+
135
+ def test_named_bind_not_found
136
+ stmt = SQLite3::Statement.new(@db, "select :foo")
137
+ assert_raises(SQLite3::Exception) do
138
+ stmt.bind_param('bar', 'hello')
139
+ end
140
+ end
141
+
142
+ def test_each
143
+ r = nil
144
+ @stmt.each do |row|
145
+ r = row
146
+ end
147
+ assert_equal(['foo'], r)
148
+ end
149
+
150
+ def test_reset!
151
+ r = []
152
+ @stmt.each { |row| r << row }
153
+ @stmt.reset!
154
+ @stmt.each { |row| r << row }
155
+ assert_equal [['foo'], ['foo']], r
156
+ end
157
+
158
+ def test_step
159
+ r = @stmt.step
160
+ assert_equal ['foo'], r
161
+ end
162
+
163
+ def test_tainted
164
+ r = @stmt.step
165
+ assert r.first.tainted?
166
+ end
167
+
168
+ def test_step_twice
169
+ assert_not_nil @stmt.step
170
+ assert !@stmt.done?
171
+ assert_nil @stmt.step
172
+ assert @stmt.done?
173
+
174
+ @stmt.reset!
175
+ assert !@stmt.done?
176
+ end
177
+
178
+ def test_step_never_moves_past_done
179
+ 10.times { @stmt.step }
180
+ @stmt.done?
181
+ end
182
+
183
+ def test_column_count
184
+ assert_equal 1, @stmt.column_count
185
+ end
186
+
187
+ def test_column_name
188
+ assert_equal "'foo'", @stmt.column_name(0)
189
+ assert_equal nil, @stmt.column_name(10)
190
+ end
191
+
192
+ def test_bind_parameter_count
193
+ stmt = SQLite3::Statement.new(@db, "select ?, ?, ?")
194
+ assert_equal 3, stmt.bind_parameter_count
195
+ end
196
+
197
+ def test_execute_with_varargs
198
+ stmt = @db.prepare('select ?, ?')
199
+ assert_equal [[nil, nil]], stmt.execute(nil, nil).to_a
200
+ end
201
+
202
+ def test_execute_with_hash
203
+ stmt = @db.prepare('select :n, :h')
204
+ assert_equal [[10, nil]], stmt.execute('n' => 10, 'h' => nil).to_a
205
+ end
206
+ end
207
+ end
@@ -0,0 +1,35 @@
1
+ require 'helper'
2
+
3
+ module SQLite3
4
+ class TestStatementExecute < Test::Unit::TestCase
5
+ def setup
6
+ @db = SQLite3::Database.new(':memory:')
7
+ @db.execute_batch(
8
+ "CREATE TABLE items (id integer PRIMARY KEY, number integer)")
9
+ end
10
+
11
+ def test_execute_insert
12
+ ps = @db.prepare("INSERT INTO items (number) VALUES (:n)")
13
+ ps.execute('n'=>10)
14
+ assert_equal 1, @db.get_first_value("SELECT count(*) FROM items")
15
+ ps.close
16
+ end
17
+
18
+ def test_execute_update
19
+ @db.execute("INSERT INTO items (number) VALUES (?)", [10])
20
+
21
+ ps = @db.prepare("UPDATE items SET number = :new WHERE number = :old")
22
+ ps.execute('old'=>10, 'new'=>20)
23
+ assert_equal 20, @db.get_first_value("SELECT number FROM items")
24
+ ps.close
25
+ end
26
+
27
+ def test_execute_delete
28
+ @db.execute("INSERT INTO items (number) VALUES (?)", [20])
29
+ ps = @db.prepare("DELETE FROM items WHERE number = :n")
30
+ ps.execute('n' => 20)
31
+ assert_equal 0, @db.get_first_value("SELECT count(*) FROM items")
32
+ ps.close
33
+ end
34
+ end
35
+ end
metadata ADDED
@@ -0,0 +1,202 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sqlite3
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 3
9
+ - 3
10
+ version: 1.3.3
11
+ platform: x86-mswin32-60
12
+ authors:
13
+ - Jamis Buck
14
+ - Luis Lavena
15
+ - Aaron Patterson
16
+ autorequire:
17
+ bindir: bin
18
+ cert_chain: []
19
+
20
+ date: 2011-01-16 00:00:00 -08:00
21
+ default_executable:
22
+ dependencies:
23
+ - !ruby/object:Gem::Dependency
24
+ name: rake-compiler
25
+ prerelease: false
26
+ requirement: &id001 !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ hash: 3
32
+ segments:
33
+ - 0
34
+ - 7
35
+ - 0
36
+ version: 0.7.0
37
+ type: :development
38
+ version_requirements: *id001
39
+ - !ruby/object:Gem::Dependency
40
+ name: hoe
41
+ prerelease: false
42
+ requirement: &id002 !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ hash: 47
48
+ segments:
49
+ - 2
50
+ - 8
51
+ - 0
52
+ version: 2.8.0
53
+ type: :development
54
+ version_requirements: *id002
55
+ description: |-
56
+ This module allows Ruby programs to interface with the SQLite3
57
+ database engine (http://www.sqlite.org). You must have the
58
+ SQLite engine installed in order to build this module.
59
+
60
+ Note that this module is NOT compatible with SQLite 2.x.
61
+ email:
62
+ - jamis@37signals.com
63
+ - luislavena@gmail.com
64
+ - aaron@tenderlovemaking.com
65
+ executables: []
66
+
67
+ extensions: []
68
+
69
+ extra_rdoc_files:
70
+ - Manifest.txt
71
+ - API_CHANGES.rdoc
72
+ - CHANGELOG.rdoc
73
+ - README.rdoc
74
+ - ext/sqlite3/backup.c
75
+ - ext/sqlite3/database.c
76
+ - ext/sqlite3/exception.c
77
+ - ext/sqlite3/sqlite3.c
78
+ - ext/sqlite3/statement.c
79
+ files:
80
+ - API_CHANGES.rdoc
81
+ - CHANGELOG.rdoc
82
+ - ChangeLog.cvs
83
+ - LICENSE
84
+ - Manifest.txt
85
+ - README.rdoc
86
+ - Rakefile
87
+ - ext/sqlite3/backup.c
88
+ - ext/sqlite3/backup.h
89
+ - ext/sqlite3/database.c
90
+ - ext/sqlite3/database.h
91
+ - ext/sqlite3/exception.c
92
+ - ext/sqlite3/exception.h
93
+ - ext/sqlite3/extconf.rb
94
+ - ext/sqlite3/sqlite3.c
95
+ - ext/sqlite3/sqlite3_ruby.h
96
+ - ext/sqlite3/statement.c
97
+ - ext/sqlite3/statement.h
98
+ - faq/faq.rb
99
+ - faq/faq.yml
100
+ - lib/sqlite3.rb
101
+ - lib/sqlite3/constants.rb
102
+ - lib/sqlite3/database.rb
103
+ - lib/sqlite3/errors.rb
104
+ - lib/sqlite3/pragmas.rb
105
+ - lib/sqlite3/resultset.rb
106
+ - lib/sqlite3/statement.rb
107
+ - lib/sqlite3/translator.rb
108
+ - lib/sqlite3/value.rb
109
+ - lib/sqlite3/version.rb
110
+ - setup.rb
111
+ - tasks/faq.rake
112
+ - tasks/gem.rake
113
+ - tasks/native.rake
114
+ - tasks/vendor_sqlite3.rake
115
+ - test/helper.rb
116
+ - test/test_backup.rb
117
+ - test/test_collation.rb
118
+ - test/test_database.rb
119
+ - test/test_database_readonly.rb
120
+ - test/test_deprecated.rb
121
+ - test/test_encoding.rb
122
+ - test/test_integration.rb
123
+ - test/test_integration_open_close.rb
124
+ - test/test_integration_pending.rb
125
+ - test/test_integration_resultset.rb
126
+ - test/test_integration_statement.rb
127
+ - test/test_sqlite3.rb
128
+ - test/test_statement.rb
129
+ - test/test_statement_execute.rb
130
+ - lib/sqlite3/1.8/sqlite3_native.so
131
+ - lib/sqlite3/1.9/sqlite3_native.so
132
+ has_rdoc: true
133
+ homepage: http://github.com/luislavena/sqlite3-ruby
134
+ licenses: []
135
+
136
+ post_install_message: |+
137
+
138
+ =============================================================================
139
+
140
+ You've installed the binary version of sqlite3.
141
+ It was built using SQLite3 version 3.7.3.
142
+ It's recommended to use the exact same version to avoid potential issues.
143
+
144
+ At the time of building this gem, the necessary DLL files where available
145
+ in the following download:
146
+
147
+ http://www.sqlite.org/sqlitedll-3_7_3.zip
148
+
149
+ You can put the sqlite3.dll available in this package in your Ruby bin
150
+ directory, for example C:\Ruby\bin
151
+
152
+ =============================================================================
153
+
154
+ rdoc_options:
155
+ - --main
156
+ - README.rdoc
157
+ require_paths:
158
+ - lib
159
+ required_ruby_version: !ruby/object:Gem::Requirement
160
+ none: false
161
+ requirements:
162
+ - - ">="
163
+ - !ruby/object:Gem::Version
164
+ hash: 57
165
+ segments:
166
+ - 1
167
+ - 8
168
+ - 7
169
+ version: 1.8.7
170
+ required_rubygems_version: !ruby/object:Gem::Requirement
171
+ none: false
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ hash: 17
176
+ segments:
177
+ - 1
178
+ - 3
179
+ - 5
180
+ version: 1.3.5
181
+ requirements: []
182
+
183
+ rubyforge_project: sqlite3
184
+ rubygems_version: 1.3.7
185
+ signing_key:
186
+ specification_version: 3
187
+ summary: This module allows Ruby programs to interface with the SQLite3 database engine (http://www.sqlite.org)
188
+ test_files:
189
+ - test/test_backup.rb
190
+ - test/test_collation.rb
191
+ - test/test_database.rb
192
+ - test/test_database_readonly.rb
193
+ - test/test_deprecated.rb
194
+ - test/test_encoding.rb
195
+ - test/test_integration.rb
196
+ - test/test_integration_open_close.rb
197
+ - test/test_integration_pending.rb
198
+ - test/test_integration_resultset.rb
199
+ - test/test_integration_statement.rb
200
+ - test/test_sqlite3.rb
201
+ - test/test_statement.rb
202
+ - test/test_statement_execute.rb