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.
Files changed (51) hide show
  1. data/API_CHANGES.rdoc +48 -0
  2. data/{History.txt → CHANGELOG.rdoc} +24 -0
  3. data/Manifest.txt +14 -14
  4. data/{README.txt → README.rdoc} +1 -6
  5. data/Rakefile +8 -3
  6. data/ext/sqlite3/database.c +687 -0
  7. data/ext/sqlite3/database.h +15 -0
  8. data/ext/sqlite3/exception.c +94 -0
  9. data/ext/sqlite3/exception.h +8 -0
  10. data/ext/sqlite3/extconf.rb +26 -0
  11. data/ext/sqlite3/sqlite3.c +33 -0
  12. data/ext/sqlite3/sqlite3_ruby.h +43 -0
  13. data/ext/sqlite3/statement.c +412 -0
  14. data/ext/sqlite3/statement.h +16 -0
  15. data/lib/sqlite3.rb +9 -0
  16. data/lib/sqlite3/1.8/sqlite3_native.so +0 -0
  17. data/lib/sqlite3/1.9/sqlite3_native.so +0 -0
  18. data/lib/sqlite3/database.rb +94 -302
  19. data/lib/sqlite3/errors.rb +0 -24
  20. data/lib/sqlite3/pragmas.rb +16 -7
  21. data/lib/sqlite3/resultset.rb +25 -81
  22. data/lib/sqlite3/statement.rb +22 -107
  23. data/lib/sqlite3/version.rb +4 -4
  24. data/setup.rb +2 -2
  25. data/tasks/native.rake +13 -17
  26. data/tasks/vendor_sqlite3.rake +10 -7
  27. data/test/helper.rb +1 -65
  28. data/test/test_database.rb +239 -189
  29. data/test/test_encoding.rb +115 -0
  30. data/test/test_integration.rb +38 -35
  31. data/test/test_integration_open_close.rb +1 -1
  32. data/test/test_integration_pending.rb +6 -4
  33. data/test/test_integration_resultset.rb +20 -8
  34. data/test/test_integration_statement.rb +1 -2
  35. data/test/test_sqlite3.rb +9 -0
  36. data/test/test_statement.rb +193 -0
  37. metadata +84 -49
  38. data/ext/sqlite3_api/extconf.rb +0 -10
  39. data/ext/sqlite3_api/sqlite3_api.i +0 -362
  40. data/ext/sqlite3_api/sqlite3_api_wrap.c +0 -5018
  41. data/lib/1.8/sqlite3_api.so +0 -0
  42. data/lib/1.9/sqlite3_api.so +0 -0
  43. data/lib/sqlite3/driver/dl/api.rb +0 -152
  44. data/lib/sqlite3/driver/dl/driver.rb +0 -307
  45. data/lib/sqlite3/driver/native/driver.rb +0 -219
  46. data/tasks/benchmark.rake +0 -9
  47. data/tasks/gem.rake +0 -32
  48. data/test/bm.rb +0 -140
  49. data/test/driver/dl/tc_driver.rb +0 -292
  50. data/test/native-vs-dl.rb +0 -126
  51. data/test/test_errors.rb +0 -17
data/test/native-vs-dl.rb DELETED
@@ -1,126 +0,0 @@
1
- $:.unshift "../lib", "../ext/sqlite3_api"
2
-
3
- require 'sqlite3'
4
-
5
- require 'benchmark'
6
-
7
- N = 1000
8
-
9
- $VERBOSE=nil
10
-
11
- puts "database creation..."
12
- Benchmark.bm( 7 ) do |x|
13
- x.report('dl') do
14
- N.times do
15
- File.delete "test.db" rescue nil
16
- SQLite3::Database.open( "test.db", :driver => "DL" ).close
17
- end
18
- end
19
- x.report('native') do
20
- N.times do
21
- File.delete "test.db" rescue nil
22
- SQLite3::Database.open( "test.db", :driver => "Native" ).close
23
- end
24
- end
25
- end
26
- File.delete "test.db" rescue nil
27
-
28
- SQLite3::Database.open( "test.db" ).close
29
-
30
- puts
31
- puts "database open..."
32
- Benchmark.bm( 7 ) do |x|
33
- x.report('dl') do
34
- N.times do
35
- SQLite3::Database.open( "test.db", :driver => "DL" ).close
36
- end
37
- end
38
- x.report('native') do
39
- N.times do
40
- SQLite3::Database.open( "test.db", :driver => "Native" ).close
41
- end
42
- end
43
- end
44
- File.delete "test.db" rescue nil
45
-
46
- dl = SQLite3::Database.open( "test-dl.db", :driver => "DL" )
47
- native = SQLite3::Database.open( "test-native.db", :driver => "Native" )
48
-
49
- dl.execute "create table foo (a,b)"
50
- native.execute "create table foo (a,b)"
51
-
52
- puts
53
- puts "insertions"
54
- Benchmark.bm( 7 ) do |x|
55
- x.report('dl') do
56
- dl.transaction do
57
- N.times do |i|
58
- dl.execute "insert into foo values (#{i}, #{i+1})"
59
- end
60
- end
61
- end
62
- x.report('native') do
63
- native.transaction do
64
- N.times do |i|
65
- native.execute "insert into foo values (#{i}, #{i+1})"
66
- end
67
- end
68
- end
69
- end
70
-
71
- puts
72
- puts "insertions using prepared statement"
73
- Benchmark.bm( 7 ) do |x|
74
- x.report('dl') do
75
- dl.transaction do
76
- dl.prepare "insert into foo values (?,?)" do |stmt|
77
- N.times { |i| stmt.execute i, i+1 }
78
- end
79
- end
80
- end
81
- x.report('native') do
82
- native.transaction do
83
- native.prepare( "insert into foo values (?,?)" ) do |stmt|
84
- N.times { |i| stmt.execute i, i+1 }
85
- end
86
- end
87
- end
88
- end
89
-
90
- dl.close
91
- native.close
92
- File.delete "test-dl.db" rescue nil
93
- File.delete "test-native.db" rescue nil
94
-
95
- dl = SQLite3::Database.open( "test-dl.db", :driver => "DL" )
96
- native = SQLite3::Database.open( "test-native.db", :driver => "Native" )
97
-
98
- dl.execute "create table foo (a,b)"
99
- dl.execute "insert into foo values (1,2)"
100
- dl.execute "insert into foo values (3,4)"
101
- dl.execute "insert into foo values (5,6)"
102
-
103
- native.execute "create table foo (a,b)"
104
- native.execute "insert into foo values (1,2)"
105
- native.execute "insert into foo values (3,4)"
106
- native.execute "insert into foo values (5,6)"
107
-
108
- puts
109
- puts "queries"
110
- Benchmark.bm( 7 ) do |x|
111
- x.report('dl') do
112
- N.times do
113
- dl.execute "select * from foo"
114
- end
115
- end
116
- x.report('native') do
117
- N.times do
118
- native.execute "select * from foo"
119
- end
120
- end
121
- end
122
-
123
- dl.close
124
- native.close
125
- File.delete "test-dl.db" rescue nil
126
- File.delete "test-native.db" rescue nil
data/test/test_errors.rb DELETED
@@ -1,17 +0,0 @@
1
- require File.join(File.dirname(__FILE__), 'helper')
2
-
3
- class TC_Errors < Test::Unit::TestCase
4
- (1..26).each do |code|
5
- define_method( "test_error_code_%02d" % code ) do
6
- db = stub('database', :errmsg => 'message')
7
- begin
8
- SQLite3::Error.check( code, db )
9
- rescue SQLite3::Exception => e
10
- assert_instance_of SQLite3::EXCEPTIONS[code], e
11
- assert_equal code, e.code
12
- assert_equal code, e.class.code
13
- assert_equal "message", e.message
14
- end
15
- end
16
- end
17
- end