sqlite3-ruby 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sqlite3-ruby might be problematic. Click here for more details.
- data/README +24 -5
- data/doc/faq/faq.html +58 -32
- data/ext/sqlite3_api/Makefile +143 -0
- data/ext/sqlite3_api/extconf.rb +7 -2
- data/ext/sqlite3_api/sqlite3_api.i +12 -0
- data/ext/sqlite3_api/sqlite3_api_wrap.c +3095 -0
- data/ext/sqlite3_api/win32/build.bat +7 -0
- data/lib/sqlite3/database.rb +4 -3
- data/lib/sqlite3/driver/dl/driver.rb +4 -0
- data/lib/sqlite3/driver/native/driver.rb +35 -10
- data/lib/sqlite3/errors.rb +1 -1
- data/lib/sqlite3/resultset.rb +1 -0
- data/lib/sqlite3/statement.rb +22 -4
- data/lib/sqlite3/translator.rb +1 -0
- data/lib/sqlite3/version.rb +1 -1
- data/test/driver/dl/tc_driver.rb +262 -260
- data/test/mocks.rb +3 -0
- data/test/tc_integration.rb +64 -16
- metadata +61 -54
- data/ext/sqlite3_api/post-clean.rb +0 -3
- data/ext/sqlite3_api/post-distclean.rb +0 -4
data/test/mocks.rb
CHANGED
data/test/tc_integration.rb
CHANGED
@@ -1,15 +1,14 @@
|
|
1
|
-
$:.unshift "
|
2
|
-
$:.unshift "
|
1
|
+
$:.unshift "#{File.dirname(__FILE__)}/../lib"
|
2
|
+
$:.unshift "#{File.dirname(__FILE__)}/../ext/sqlite3_api"
|
3
3
|
|
4
4
|
require 'test/unit'
|
5
5
|
require 'benchmark'
|
6
6
|
require 'sqlite3/database'
|
7
7
|
|
8
8
|
class String
|
9
|
-
def to_utf16
|
10
|
-
|
11
|
-
|
12
|
-
result
|
9
|
+
def to_utf16(terminate=false)
|
10
|
+
self.split(//).map { |c| c[0] }.pack("v*") +
|
11
|
+
(terminate ? "\0\0" : "")
|
13
12
|
end
|
14
13
|
|
15
14
|
def from_utf16
|
@@ -78,6 +77,11 @@ module Integration
|
|
78
77
|
File.delete( "test.db" )
|
79
78
|
end
|
80
79
|
|
80
|
+
define_method( "test_table_info_with_type_translation_active" ) do
|
81
|
+
@db.type_translation = true
|
82
|
+
assert_nothing_raised { @db.table_info("foo") }
|
83
|
+
end
|
84
|
+
|
81
85
|
define_method( "test_complete_fail" ) do
|
82
86
|
assert !@db.complete?( "select * from foo" )
|
83
87
|
end
|
@@ -86,10 +90,11 @@ module Integration
|
|
86
90
|
end
|
87
91
|
|
88
92
|
define_method( "test_complete_fail_utf16" ) do
|
89
|
-
assert !@db.complete?( "select * from foo".to_utf16
|
93
|
+
assert !@db.complete?( "select * from foo".to_utf16(false), true )
|
90
94
|
end
|
95
|
+
|
91
96
|
define_method( "test_complete_success_utf16" ) do
|
92
|
-
assert @db.complete?( "select * from foo;".to_utf16
|
97
|
+
assert @db.complete?( "select * from foo;".to_utf16(true), true )
|
93
98
|
end
|
94
99
|
|
95
100
|
define_method( "test_errmsg" ) do
|
@@ -124,11 +129,12 @@ module Integration
|
|
124
129
|
end
|
125
130
|
end
|
126
131
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
+
# FIXME: this test is failing with sqlite3 3.2.5
|
133
|
+
# define_method( "test_authorizer_silent" ) do
|
134
|
+
# @db.authorizer( "data" ) { |data,type,a,b,c,d| 2 }
|
135
|
+
# rows = @db.execute "select * from foo"
|
136
|
+
# assert rows.empty?
|
137
|
+
# end
|
132
138
|
|
133
139
|
define_method( "test_prepare_invalid_syntax" ) do
|
134
140
|
assert_raise( SQLite3::SQLException ) do
|
@@ -507,13 +513,13 @@ module Integration
|
|
507
513
|
handler_call_count = 0
|
508
514
|
db2.busy_handler do |data,count|
|
509
515
|
handler_call_count += 1
|
510
|
-
sleep 0.
|
516
|
+
sleep 0.5
|
511
517
|
1
|
512
518
|
end
|
513
519
|
|
514
520
|
t = Thread.new do
|
515
521
|
@db.transaction( :exclusive ) do
|
516
|
-
sleep 0.
|
522
|
+
sleep 0.3
|
517
523
|
end
|
518
524
|
end
|
519
525
|
|
@@ -708,6 +714,16 @@ module Integration
|
|
708
714
|
assert_equal 1, @stmt.execute!.length
|
709
715
|
end
|
710
716
|
|
717
|
+
define_method( "test_bind_params_hash_without_colon" ) do
|
718
|
+
@stmt.bind_params "named" => 2
|
719
|
+
assert_equal 1, @stmt.execute!.length
|
720
|
+
end
|
721
|
+
|
722
|
+
define_method( "test_bind_params_hash_as_symbol" ) do
|
723
|
+
@stmt.bind_params :named => 2
|
724
|
+
assert_equal 1, @stmt.execute!.length
|
725
|
+
end
|
726
|
+
|
711
727
|
define_method( "test_bind_params_mixed" ) do
|
712
728
|
@stmt.bind_params( 1, ":named" => 2 )
|
713
729
|
assert_equal 2, @stmt.execute!.length
|
@@ -719,7 +735,7 @@ module Integration
|
|
719
735
|
end
|
720
736
|
|
721
737
|
define_method( "test_bind_param_by_name_bad" ) do
|
722
|
-
assert_raise( SQLite3::Exception ) { @stmt.bind_param( "named", 2 ) }
|
738
|
+
assert_raise( SQLite3::Exception ) { @stmt.bind_param( "@named", 2 ) }
|
723
739
|
end
|
724
740
|
|
725
741
|
define_method( "test_bind_param_by_name_good" ) do
|
@@ -727,6 +743,17 @@ module Integration
|
|
727
743
|
assert_equal 1, @stmt.execute!.length
|
728
744
|
end
|
729
745
|
|
746
|
+
define_method( "test_bind_param_with_various_types" ) do
|
747
|
+
@db.transaction do
|
748
|
+
@db.execute "create table all_types ( a integer primary key, b float, c string, d integer )"
|
749
|
+
@db.execute "insert into all_types ( b, c, d ) values ( 1.4, 'hello', 68719476735 )"
|
750
|
+
end
|
751
|
+
|
752
|
+
assert_equal 1, @db.execute( "select * from all_types where b = ?", 1.4 ).length
|
753
|
+
assert_equal 1, @db.execute( "select * from all_types where c = ?", 'hello').length
|
754
|
+
assert_equal 1, @db.execute( "select * from all_types where d = ?", 68719476735).length
|
755
|
+
end
|
756
|
+
|
730
757
|
define_method( "test_execute_no_bind_no_block" ) do
|
731
758
|
assert_instance_of SQLite3::ResultSet, @stmt.execute
|
732
759
|
end
|
@@ -819,6 +846,20 @@ module Integration
|
|
819
846
|
assert_raise( SQLite3::Exception ) { stmt.columns }
|
820
847
|
assert_raise( SQLite3::Exception ) { stmt.types }
|
821
848
|
end
|
849
|
+
|
850
|
+
define_method( "test_committing_tx_with_statement_active" ) do
|
851
|
+
called = false
|
852
|
+
@db.prepare( "select count(*) from foo" ) do |stmt|
|
853
|
+
called = true
|
854
|
+
count = stmt.execute!.first.first.to_i
|
855
|
+
@db.transaction do
|
856
|
+
@db.execute "insert into foo ( b ) values ( 'hello' )"
|
857
|
+
end
|
858
|
+
new_count = stmt.execute!.first.first.to_i
|
859
|
+
assert_equal new_count, count+1
|
860
|
+
end
|
861
|
+
assert called
|
862
|
+
end
|
822
863
|
end
|
823
864
|
const_set( "TC_Statement_#{driver}", test_case )
|
824
865
|
|
@@ -889,6 +930,13 @@ module Integration
|
|
889
930
|
assert_equal [ 1, "foo" ], @result.next
|
890
931
|
end
|
891
932
|
|
933
|
+
define_method( "test_next_type_translation_with_untyped_column" ) do
|
934
|
+
@db.type_translation = true
|
935
|
+
@db.query( "select count(*) from foo" ) do |result|
|
936
|
+
assert_equal ["3"], result.next
|
937
|
+
end
|
938
|
+
end
|
939
|
+
|
892
940
|
define_method( "test_next_results_as_hash" ) do
|
893
941
|
@db.results_as_hash = true
|
894
942
|
@result.reset( 1 )
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.
|
2
|
+
rubygems_version: 0.9.0
|
3
3
|
specification_version: 1
|
4
4
|
name: sqlite3-ruby
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.
|
7
|
-
date:
|
6
|
+
version: 1.2.0
|
7
|
+
date: 2007-01-13 00:00:00 -07:00
|
8
8
|
summary: SQLite3/Ruby is a module to allow Ruby scripts to interface with a SQLite3 database.
|
9
9
|
require_paths:
|
10
|
-
|
11
|
-
email:
|
10
|
+
- lib
|
11
|
+
email: jamis@37signals.com
|
12
12
|
homepage: http://sqlite-ruby.rubyforge.org/sqlite3
|
13
13
|
rubyforge_project:
|
14
14
|
description:
|
@@ -18,62 +18,69 @@ bindir: bin
|
|
18
18
|
has_rdoc: true
|
19
19
|
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
20
|
requirements:
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
version: 1.8.0
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.8.0
|
25
24
|
version:
|
26
25
|
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
27
29
|
authors:
|
28
|
-
|
30
|
+
- Jamis Buck
|
29
31
|
files:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
32
|
+
- doc/faq
|
33
|
+
- doc/faq/faq.html
|
34
|
+
- doc/faq/faq.rb
|
35
|
+
- doc/faq/faq.yml
|
36
|
+
- ext/sqlite3_api
|
37
|
+
- ext/sqlite3_api/extconf.rb
|
38
|
+
- ext/sqlite3_api/Makefile
|
39
|
+
- ext/sqlite3_api/MANIFEST
|
40
|
+
- ext/sqlite3_api/sqlite3_api.i
|
41
|
+
- ext/sqlite3_api/sqlite3_api_wrap.c
|
42
|
+
- ext/sqlite3_api/win32
|
43
|
+
- ext/sqlite3_api/win32/build.bat
|
44
|
+
- lib/sqlite3
|
45
|
+
- lib/sqlite3.rb
|
46
|
+
- lib/sqlite3/constants.rb
|
47
|
+
- lib/sqlite3/database.rb
|
48
|
+
- lib/sqlite3/driver
|
49
|
+
- lib/sqlite3/errors.rb
|
50
|
+
- lib/sqlite3/pragmas.rb
|
51
|
+
- lib/sqlite3/resultset.rb
|
52
|
+
- lib/sqlite3/statement.rb
|
53
|
+
- lib/sqlite3/translator.rb
|
54
|
+
- lib/sqlite3/value.rb
|
55
|
+
- lib/sqlite3/version.rb
|
56
|
+
- lib/sqlite3/driver/dl
|
57
|
+
- lib/sqlite3/driver/native
|
58
|
+
- lib/sqlite3/driver/dl/api.rb
|
59
|
+
- lib/sqlite3/driver/dl/driver.rb
|
60
|
+
- lib/sqlite3/driver/native/driver.rb
|
61
|
+
- test/bm.rb
|
62
|
+
- test/driver
|
63
|
+
- test/mocks.rb
|
64
|
+
- test/native-vs-dl.rb
|
65
|
+
- test/tc_database.rb
|
66
|
+
- test/tc_errors.rb
|
67
|
+
- test/tc_integration.rb
|
68
|
+
- test/tests.rb
|
69
|
+
- test/driver/dl
|
70
|
+
- test/driver/dl/tc_driver.rb
|
71
|
+
- README
|
68
72
|
test_files:
|
69
|
-
|
73
|
+
- test/tests.rb
|
70
74
|
rdoc_options:
|
71
|
-
|
72
|
-
|
75
|
+
- --main
|
76
|
+
- README
|
73
77
|
extra_rdoc_files:
|
74
|
-
|
78
|
+
- README
|
75
79
|
executables: []
|
80
|
+
|
76
81
|
extensions:
|
77
|
-
|
82
|
+
- ext/sqlite3_api/extconf.rb
|
78
83
|
requirements: []
|
79
|
-
|
84
|
+
|
85
|
+
dependencies: []
|
86
|
+
|