sqlite3-ruby 1.3.2 → 1.3.3.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. metadata +25 -100
  2. data/API_CHANGES.rdoc +0 -50
  3. data/CHANGELOG.rdoc +0 -171
  4. data/ChangeLog.cvs +0 -88
  5. data/LICENSE +0 -27
  6. data/Manifest.txt +0 -50
  7. data/README.rdoc +0 -74
  8. data/Rakefile +0 -10
  9. data/ext/sqlite3/backup.c +0 -164
  10. data/ext/sqlite3/backup.h +0 -15
  11. data/ext/sqlite3/database.c +0 -762
  12. data/ext/sqlite3/database.h +0 -15
  13. data/ext/sqlite3/exception.c +0 -94
  14. data/ext/sqlite3/exception.h +0 -8
  15. data/ext/sqlite3/extconf.rb +0 -43
  16. data/ext/sqlite3/sqlite3.c +0 -36
  17. data/ext/sqlite3/sqlite3_ruby.h +0 -44
  18. data/ext/sqlite3/statement.c +0 -419
  19. data/ext/sqlite3/statement.h +0 -16
  20. data/faq/faq.rb +0 -145
  21. data/faq/faq.yml +0 -426
  22. data/lib/sqlite3.rb +0 -10
  23. data/lib/sqlite3/constants.rb +0 -49
  24. data/lib/sqlite3/database.rb +0 -587
  25. data/lib/sqlite3/errors.rb +0 -44
  26. data/lib/sqlite3/pragmas.rb +0 -280
  27. data/lib/sqlite3/resultset.rb +0 -126
  28. data/lib/sqlite3/statement.rb +0 -148
  29. data/lib/sqlite3/translator.rb +0 -118
  30. data/lib/sqlite3/value.rb +0 -57
  31. data/lib/sqlite3/version.rb +0 -25
  32. data/setup.rb +0 -1333
  33. data/tasks/faq.rake +0 -9
  34. data/tasks/gem.rake +0 -31
  35. data/tasks/native.rake +0 -61
  36. data/tasks/vendor_sqlite3.rake +0 -104
  37. data/test/helper.rb +0 -3
  38. data/test/test_backup.rb +0 -33
  39. data/test/test_collation.rb +0 -82
  40. data/test/test_database.rb +0 -312
  41. data/test/test_database_readonly.rb +0 -29
  42. data/test/test_deprecated.rb +0 -33
  43. data/test/test_encoding.rb +0 -119
  44. data/test/test_integration.rb +0 -544
  45. data/test/test_integration_open_close.rb +0 -30
  46. data/test/test_integration_pending.rb +0 -115
  47. data/test/test_integration_resultset.rb +0 -156
  48. data/test/test_integration_statement.rb +0 -194
  49. data/test/test_sqlite3.rb +0 -9
  50. data/test/test_statement.rb +0 -207
  51. data/test/test_statement_execute.rb +0 -35
@@ -1,9 +0,0 @@
1
- # Generate FAQ
2
- desc "Generate the FAQ document"
3
- task :faq => ['faq/faq.html']
4
-
5
- file 'faq/faq.html' => ['faq/faq.rb', 'faq/faq.yml'] do
6
- cd 'faq' do
7
- ruby "faq.rb > faq.html"
8
- end
9
- end
@@ -1,31 +0,0 @@
1
- begin
2
- require 'hoe'
3
- rescue LoadError
4
- # try with rubygems?
5
- require 'rubygems'
6
- require 'hoe'
7
- end
8
-
9
- Hoe.plugin :debugging, :doofus, :git
10
-
11
- HOE = Hoe.spec 'sqlite3-ruby' do
12
- developer 'Jamis Buck', 'jamis@37signals.com'
13
- developer 'Luis Lavena', 'luislavena@gmail.com'
14
- developer 'Aaron Patterson', 'aaron@tenderlovemaking.com'
15
-
16
- self.readme_file = 'README.rdoc'
17
- self.history_file = 'CHANGELOG.rdoc'
18
- self.extra_rdoc_files = FileList['*.rdoc', 'ext/**/*.c']
19
-
20
- spec_extras[:required_ruby_version] = Gem::Requirement.new('>= 1.8.7')
21
- spec_extras[:required_rubygems_version] = '>= 1.3.5'
22
- spec_extras[:extensions] = ["ext/sqlite3/extconf.rb"]
23
-
24
- extra_dev_deps << ['rake-compiler', "~> 0.7.0"]
25
-
26
- clean_globs.push('**/test.db')
27
- end
28
-
29
- Hoe.add_include_dirs '.'
30
-
31
- # vim: syntax=ruby
@@ -1,61 +0,0 @@
1
- # use rake-compiler for building the extension
2
- require 'rake/extensiontask'
3
-
4
- # NOTE: version used by cross compilation of Windows native extension
5
- # It do not affect compilation under other operating systems
6
- # The version indicated is the minimum DLL suggested for correct functionality
7
- BINARY_VERSION = '3.7.3'
8
- URL_VERSION = BINARY_VERSION.gsub('.', '_')
9
-
10
- # build sqlite3_native C extension
11
- Rake::ExtensionTask.new('sqlite3_native', HOE.spec) do |ext|
12
- # where to locate the extension
13
- ext.ext_dir = 'ext/sqlite3'
14
-
15
- # where native extension will be copied (matches makefile)
16
- ext.lib_dir = "lib/sqlite3"
17
-
18
- # reference to the sqlite3 library
19
- sqlite3_lib = File.expand_path(File.join(File.dirname(__FILE__), '..', 'vendor', 'sqlite3'))
20
-
21
- # clean binary folders always
22
- CLEAN.include("#{ext.lib_dir}/?.?")
23
-
24
- # automatically add build options to avoid need of manual input
25
- if RUBY_PLATFORM =~ /mswin|mingw/ then
26
- # define target for extension (supporting fat binaries)
27
- RUBY_VERSION =~ /(\d+\.\d+)/
28
- ext.lib_dir = "lib/sqlite3/#{$1}"
29
- ext.config_options << "--with-sqlite3-dir=#{sqlite3_lib}"
30
- else
31
- ext.cross_compile = true
32
- ext.cross_platform = ['i386-mswin32-60', 'i386-mingw32']
33
- ext.cross_config_options << "--with-sqlite3-dir=#{sqlite3_lib}"
34
- ext.cross_compiling do |gemspec|
35
- gemspec.post_install_message = <<-POST_INSTALL_MESSAGE
36
-
37
- =============================================================================
38
-
39
- You've installed the binary version of #{gemspec.name}.
40
- It was built using SQLite3 version #{BINARY_VERSION}.
41
- It's recommended to use the exact same version to avoid potential issues.
42
-
43
- At the time of building this gem, the necessary DLL files where available
44
- in the following download:
45
-
46
- http://www.sqlite.org/sqlitedll-#{URL_VERSION}.zip
47
-
48
- You can put the sqlite3.dll available in this package in your Ruby bin
49
- directory, for example C:\\Ruby\\bin
50
-
51
- =============================================================================
52
-
53
- POST_INSTALL_MESSAGE
54
- end
55
- end
56
- end
57
-
58
- # ensure things are compiled prior testing
59
- task :test => [:compile]
60
-
61
- # vim: syntax=ruby
@@ -1,104 +0,0 @@
1
- require 'rake/clean'
2
- require 'rake/extensioncompiler'
3
-
4
- # download sqlite3 library and headers
5
-
6
- # only on Windows or cross platform compilation
7
- def dlltool(dllname, deffile, libfile)
8
- # define if we are using GCC or not
9
- if Rake::ExtensionCompiler.mingw_gcc_executable then
10
- dir = File.dirname(Rake::ExtensionCompiler.mingw_gcc_executable)
11
- tool = case RUBY_PLATFORM
12
- when /mingw/
13
- File.join(dir, 'dlltool.exe')
14
- when /linux|darwin/
15
- File.join(dir, "#{Rake::ExtensionCompiler.mingw_host}-dlltool")
16
- end
17
- return "#{tool} --dllname #{dllname} --def #{deffile} --output-lib #{libfile}"
18
- else
19
- if RUBY_PLATFORM =~ /mswin/ then
20
- tool = 'lib.exe'
21
- else
22
- fail "Unsupported platform for cross-compilation (please, contribute some patches)."
23
- end
24
- return "#{tool} /DEF:#{deffile} /OUT:#{libfile}"
25
- end
26
- end
27
-
28
- # required folder structure for --with-sqlite3-dir (include + lib)
29
- directory "vendor/sqlite3/lib"
30
- directory "vendor/sqlite3/include"
31
-
32
- # download amalgamation version (for include files)
33
- file "vendor/sqlite-amalgamation-#{URL_VERSION}.zip" => ['vendor'] do |t|
34
- url = "http://www.sqlite.org/#{File.basename(t.name)}"
35
- when_writing "downloading #{t.name}" do
36
- cd File.dirname(t.name) do
37
- system "wget -c #{url} || curl -C - -O #{url}"
38
- end
39
- end
40
- end
41
-
42
- # download dll binaries
43
- file "vendor/sqlitedll-#{URL_VERSION}.zip" => ['vendor'] do |t|
44
- url = "http://www.sqlite.org/#{File.basename(t.name)}"
45
- when_writing "downloading #{t.name}" do
46
- cd File.dirname(t.name) do
47
- system "wget -c #{url} || curl -C - -O #{url}"
48
- end
49
- end
50
- end
51
-
52
- # extract header files into include folder
53
- file "vendor/sqlite3/include/sqlite3.h" => ['vendor/sqlite3/include', "vendor/sqlite-amalgamation-#{URL_VERSION}.zip"] do |t|
54
- full_file = File.expand_path(t.prerequisites.last)
55
- when_writing "creating #{t.name}" do
56
- cd File.dirname(t.name) do
57
- sh "unzip #{full_file}"
58
- # update file timestamp to avoid Rake perform this extraction again.
59
- touch File.basename(t.name)
60
- end
61
- end
62
- end
63
-
64
- # extract dll files into lib folder
65
- file "vendor/sqlite3/lib/sqlite3.dll" => ['vendor/sqlite3/lib', "vendor/sqlitedll-#{URL_VERSION}.zip"] do |t|
66
- full_file = File.expand_path(t.prerequisites.last)
67
- when_writing "creating #{t.name}" do
68
- cd File.dirname(t.name) do
69
- sh "unzip #{full_file}"
70
- # update file timestamp to avoid Rake perform this extraction again.
71
- touch File.basename(t.name)
72
- end
73
- end
74
- end
75
-
76
- # generate import library from definition and dll file
77
- file "vendor/sqlite3/lib/sqlite3.lib" => ["vendor/sqlite3/lib/sqlite3.dll"] do |t|
78
- libfile = t.name
79
- dllname = libfile.ext('dll')
80
- deffile = libfile.ext('def')
81
-
82
- when_writing "creating #{t.name}" do
83
- sh dlltool(dllname, deffile, libfile)
84
- end
85
- end
86
-
87
- # clean and clobber actions
88
- # All the uncompressed files must be removed at clean
89
- CLEAN.include('vendor/sqlite3')
90
-
91
- # clobber vendored packages
92
- CLOBBER.include('vendor')
93
-
94
- # vendor:sqlite3
95
- task 'vendor:sqlite3' => ["vendor/sqlite3/lib/sqlite3.lib", "vendor/sqlite3/include/sqlite3.h"]
96
-
97
- # hook into cross compilation vendored sqlite3 dependency
98
- if RUBY_PLATFORM =~ /mingw|mswin/ then
99
- Rake::Task['compile'].prerequisites.unshift 'vendor:sqlite3'
100
- else
101
- if Rake::Task.task_defined?(:cross)
102
- Rake::Task['cross'].prerequisites.unshift 'vendor:sqlite3'
103
- end
104
- end
@@ -1,3 +0,0 @@
1
- require 'sqlite3'
2
- require 'test/unit'
3
- require 'iconv'
@@ -1,33 +0,0 @@
1
- require File.expand_path('helper', File.dirname(__FILE__))
2
-
3
- module SQLite3
4
- class TestBackup < Test::Unit::TestCase
5
- def setup
6
- @sdb = SQLite3::Database.new(':memory:')
7
- @ddb = SQLite3::Database.new(':memory:')
8
- @sdb.execute('CREATE TABLE foo (idx, val);');
9
- @data = ('A'..'Z').map{|x|x * 40}
10
- @data.each_with_index do |v, i|
11
- @sdb.execute('INSERT INTO foo (idx, val) VALUES (?, ?);', [i, v])
12
- end
13
- end
14
-
15
- def test_backup_step
16
- b = SQLite3::Backup.new(@ddb, 'main', @sdb, 'main')
17
- while b.step(1) == SQLite3::Constants::ErrorCode::OK
18
- assert_not_equal(0, b.remaining)
19
- end
20
- assert_equal(0, b.remaining)
21
- b.finish
22
- assert_equal(@data.length, @ddb.execute('SELECT * FROM foo;').length)
23
- end
24
-
25
- def test_backup_all
26
- b = SQLite3::Backup.new(@ddb, 'main', @sdb, 'main')
27
- assert_equal(SQLite3::Constants::ErrorCode::DONE, b.step(-1))
28
- assert_equal(0, b.remaining)
29
- b.finish
30
- assert_equal(@data.length, @ddb.execute('SELECT * FROM foo;').length)
31
- end
32
- end
33
- end
@@ -1,82 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- require 'helper'
4
-
5
- module SQLite3
6
- class TestCollation < Test::Unit::TestCase
7
- class Comparator
8
- attr_reader :calls
9
- def initialize
10
- @calls = []
11
- end
12
-
13
- def compare left, right
14
- @calls << [left, right]
15
- left <=> right
16
- end
17
- end
18
-
19
- def setup
20
- @db = SQLite3::Database.new(':memory:')
21
- @create = "create table ex(id int, data string)"
22
- @db.execute(@create);
23
- [ [1, 'hello'], [2, 'world'] ].each do |vals|
24
- @db.execute('insert into ex (id, data) VALUES (?, ?)', vals)
25
- end
26
- end
27
-
28
- def test_custom_collation
29
- comparator = Comparator.new
30
-
31
- @db.collation 'foo', comparator
32
-
33
- assert_equal comparator, @db.collations['foo']
34
- @db.execute('select data from ex order by 1 collate foo')
35
- assert_equal 1, comparator.calls.length
36
- end
37
-
38
- def test_remove_collation
39
- comparator = Comparator.new
40
-
41
- @db.collation 'foo', comparator
42
- @db.collation 'foo', nil
43
-
44
- assert_nil @db.collations['foo']
45
- assert_raises(SQLite3::SQLException) do
46
- @db.execute('select data from ex order by 1 collate foo')
47
- end
48
- end
49
-
50
- if RUBY_VERSION >= '1.9.1'
51
- def test_encoding
52
- comparator = Comparator.new
53
- @db.collation 'foo', comparator
54
- @db.execute('select data from ex order by 1 collate foo')
55
-
56
- a, b = *comparator.calls.first
57
-
58
- assert_equal Encoding.find('UTF-8'), a.encoding
59
- assert_equal Encoding.find('UTF-8'), b.encoding
60
- end
61
-
62
- def test_encoding_default_internal
63
- warn_before = $-w
64
- $-w = false
65
- before_enc = Encoding.default_internal
66
-
67
- Encoding.default_internal = 'EUC-JP'
68
- comparator = Comparator.new
69
- @db.collation 'foo', comparator
70
- @db.execute('select data from ex order by 1 collate foo')
71
-
72
- a, b = *comparator.calls.first
73
-
74
- assert_equal Encoding.find('EUC-JP'), a.encoding
75
- assert_equal Encoding.find('EUC-JP'), b.encoding
76
- ensure
77
- Encoding.default_internal = before_enc
78
- $-w = warn_before
79
- end
80
- end
81
- end
82
- end
@@ -1,312 +0,0 @@
1
- require 'helper'
2
- require 'iconv'
3
-
4
- module SQLite3
5
- class TestDatabase < Test::Unit::TestCase
6
- def setup
7
- @db = SQLite3::Database.new(':memory:')
8
- end
9
-
10
- def test_get_first_row
11
- assert_equal [1], @db.get_first_row('SELECT 1')
12
- end
13
-
14
- def test_get_first_row_with_type_translation_and_hash_results
15
- @db.results_as_hash = true
16
- assert_equal({0=>1, "1"=>1}, @db.get_first_row('SELECT 1'))
17
- end
18
-
19
- def test_execute_with_type_translation_and_hash
20
- @db.results_as_hash = true
21
- rows = []
22
- @db.execute('SELECT 1') { |row| rows << row }
23
-
24
- assert_equal({0=>1, "1"=>1}, rows.first)
25
- end
26
-
27
- def test_encoding
28
- assert @db.encoding, 'database has encoding'
29
- end
30
-
31
- def test_changes
32
- @db.execute("CREATE TABLE items (id integer PRIMARY KEY AUTOINCREMENT, number integer)")
33
- assert_equal 0, @db.changes
34
- @db.execute("INSERT INTO items (number) VALUES (10)")
35
- assert_equal 1, @db.changes
36
- @db.execute_batch(
37
- "UPDATE items SET number = (number + :nn) WHERE (number = :n)",
38
- {"nn" => 20, "n" => 10})
39
- assert_equal 1, @db.changes
40
- assert_equal [[30]], @db.execute("select number from items")
41
- end
42
-
43
- def test_new
44
- db = SQLite3::Database.new(':memory:')
45
- assert db
46
- end
47
-
48
- def test_new_yields_self
49
- thing = nil
50
- SQLite3::Database.new(':memory:') do |db|
51
- thing = db
52
- end
53
- assert_instance_of(SQLite3::Database, thing)
54
- end
55
-
56
- def test_new_with_options
57
- db = SQLite3::Database.new(Iconv.conv('UTF-16LE', 'UTF-8', ':memory:'),
58
- :utf16 => true)
59
- assert db
60
- end
61
-
62
- def test_close
63
- db = SQLite3::Database.new(':memory:')
64
- db.close
65
- assert db.closed?
66
- end
67
-
68
- def test_block_closes_self
69
- thing = nil
70
- SQLite3::Database.new(':memory:') do |db|
71
- thing = db
72
- assert !thing.closed?
73
- end
74
- assert thing.closed?
75
- end
76
-
77
- def test_prepare
78
- db = SQLite3::Database.new(':memory:')
79
- stmt = db.prepare('select "hello world"')
80
- assert_instance_of(SQLite3::Statement, stmt)
81
- end
82
-
83
- def test_total_changes
84
- db = SQLite3::Database.new(':memory:')
85
- db.execute("create table foo ( a integer primary key, b text )")
86
- db.execute("insert into foo (b) values ('hello')")
87
- assert_equal 1, db.total_changes
88
- end
89
-
90
- def test_execute_returns_list_of_hash
91
- db = SQLite3::Database.new(':memory:', :results_as_hash => true)
92
- db.execute("create table foo ( a integer primary key, b text )")
93
- db.execute("insert into foo (b) values ('hello')")
94
- rows = db.execute("select * from foo")
95
- assert_equal [{0=>1, "a"=>1, "b"=>"hello", 1=>"hello"}], rows
96
- end
97
-
98
- def test_execute_yields_hash
99
- db = SQLite3::Database.new(':memory:', :results_as_hash => true)
100
- db.execute("create table foo ( a integer primary key, b text )")
101
- db.execute("insert into foo (b) values ('hello')")
102
- db.execute("select * from foo") do |row|
103
- assert_equal({0=>1, "a"=>1, "b"=>"hello", 1=>"hello"}, row)
104
- end
105
- end
106
-
107
- def test_table_info
108
- db = SQLite3::Database.new(':memory:', :results_as_hash => true)
109
- db.execute("create table foo ( a integer primary key, b text )")
110
- info = [{
111
- "name" => "a",
112
- "pk" => 1,
113
- "notnull" => 0,
114
- "type" => "integer",
115
- "dflt_value" => nil,
116
- "cid" => 0
117
- },
118
- {
119
- "name" => "b",
120
- "pk" => 0,
121
- "notnull" => 0,
122
- "type" => "text",
123
- "dflt_value" => nil,
124
- "cid" => 1
125
- }]
126
- assert_equal info, db.table_info('foo')
127
- end
128
-
129
- def test_total_changes_closed
130
- db = SQLite3::Database.new(':memory:')
131
- db.close
132
- assert_raise(SQLite3::Exception) do
133
- db.total_changes
134
- end
135
- end
136
-
137
- def test_trace_requires_opendb
138
- @db.close
139
- assert_raise(SQLite3::Exception) do
140
- @db.trace { |x| }
141
- end
142
- end
143
-
144
- def test_trace_with_block
145
- result = nil
146
- @db.trace { |sql| result = sql }
147
- @db.execute "select 'foo'"
148
- assert_equal "select 'foo'", result
149
- end
150
-
151
- def test_trace_with_object
152
- obj = Class.new {
153
- attr_accessor :result
154
- def call sql; @result = sql end
155
- }.new
156
-
157
- @db.trace(obj)
158
- @db.execute "select 'foo'"
159
- assert_equal "select 'foo'", obj.result
160
- end
161
-
162
- def test_trace_takes_nil
163
- @db.trace(nil)
164
- @db.execute "select 'foo'"
165
- end
166
-
167
- def test_last_insert_row_id_closed
168
- @db.close
169
- assert_raise(SQLite3::Exception) do
170
- @db.last_insert_row_id
171
- end
172
- end
173
-
174
- def test_define_function
175
- called_with = nil
176
- @db.define_function("hello") do |value|
177
- called_with = value
178
- end
179
- @db.execute("select hello(10)")
180
- assert_equal 10, called_with
181
- end
182
-
183
- def test_call_func_arg_type
184
- called_with = nil
185
- @db.define_function("hello") do |b, c, d|
186
- called_with = [b, c, d]
187
- nil
188
- end
189
- @db.execute("select hello(2.2, 'foo', NULL)")
190
- assert_equal [2.2, 'foo', nil], called_with
191
- end
192
-
193
- def test_define_varargs
194
- called_with = nil
195
- @db.define_function("hello") do |*args|
196
- called_with = args
197
- nil
198
- end
199
- @db.execute("select hello(2.2, 'foo', NULL)")
200
- assert_equal [2.2, 'foo', nil], called_with
201
- end
202
-
203
- def test_function_return
204
- @db.define_function("hello") { |a| 10 }
205
- assert_equal [10], @db.execute("select hello('world')").first
206
- end
207
-
208
- def test_function_return_types
209
- [10, 2.2, nil, "foo"].each do |thing|
210
- @db.define_function("hello") { |a| thing }
211
- assert_equal [thing], @db.execute("select hello('world')").first
212
- end
213
- end
214
-
215
- def test_define_function_closed
216
- @db.close
217
- assert_raise(SQLite3::Exception) do
218
- @db.define_function('foo') { }
219
- end
220
- end
221
-
222
- def test_inerrupt_closed
223
- @db.close
224
- assert_raise(SQLite3::Exception) do
225
- @db.interrupt
226
- end
227
- end
228
-
229
- def test_define_aggregate
230
- @db.execute "create table foo ( a integer primary key, b text )"
231
- @db.execute "insert into foo ( b ) values ( 'foo' )"
232
- @db.execute "insert into foo ( b ) values ( 'bar' )"
233
- @db.execute "insert into foo ( b ) values ( 'baz' )"
234
-
235
- acc = Class.new {
236
- attr_reader :sum
237
- alias :finalize :sum
238
- def initialize
239
- @sum = 0
240
- end
241
-
242
- def step a
243
- @sum += a
244
- end
245
- }.new
246
-
247
- @db.define_aggregator("accumulate", acc)
248
- value = @db.get_first_value( "select accumulate(a) from foo" )
249
- assert_equal 6, value
250
- end
251
-
252
- def test_authorizer_ok
253
- @db.authorizer = Class.new {
254
- def call action, a, b, c, d; true end
255
- }.new
256
- @db.prepare("select 'fooooo'")
257
-
258
- @db.authorizer = Class.new {
259
- def call action, a, b, c, d; 0 end
260
- }.new
261
- @db.prepare("select 'fooooo'")
262
- end
263
-
264
- def test_authorizer_ignore
265
- @db.authorizer = Class.new {
266
- def call action, a, b, c, d; nil end
267
- }.new
268
- stmt = @db.prepare("select 'fooooo'")
269
- assert_equal nil, stmt.step
270
- end
271
-
272
- def test_authorizer_fail
273
- @db.authorizer = Class.new {
274
- def call action, a, b, c, d; false end
275
- }.new
276
- assert_raises(SQLite3::AuthorizationException) do
277
- @db.prepare("select 'fooooo'")
278
- end
279
- end
280
-
281
- def test_remove_auth
282
- @db.authorizer = Class.new {
283
- def call action, a, b, c, d; false end
284
- }.new
285
- assert_raises(SQLite3::AuthorizationException) do
286
- @db.prepare("select 'fooooo'")
287
- end
288
-
289
- @db.authorizer = nil
290
- @db.prepare("select 'fooooo'")
291
- end
292
-
293
- def test_close_with_open_statements
294
- stmt = @db.prepare("select 'foo'")
295
- assert_raises(SQLite3::BusyException) do
296
- @db.close
297
- end
298
- end
299
-
300
- def test_execute_with_empty_bind_params
301
- assert_equal [['foo']], @db.execute("select 'foo'", [])
302
- end
303
-
304
- def test_query_with_named_bind_params
305
- assert_equal [['foo']], @db.query("select :n", {'n' => 'foo'}).to_a
306
- end
307
-
308
- def test_execute_with_named_bind_params
309
- assert_equal [['foo']], @db.execute("select :n", {'n' => 'foo'})
310
- end
311
- end
312
- end