sqlite3 1.3.8-x64-mingw32 → 1.3.9-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bf742553964b51e3b088ccb28e5da57257806372
4
+ data.tar.gz: 03857a966d234665674236a3bcf3fa7dc496d7a1
5
+ SHA512:
6
+ metadata.gz: 20bff995bfcb347216a0cf3d1b8d4b596ad155910e7be9ff7d8a3147a8f301b77ab6cd090ba0e604778fcf4a049522815c30b11a8be1b6ac63784a901f2e6cea
7
+ data.tar.gz: db92822e84331b9683ee76a8b94f7304a8d261c92c00416a6ec039e0dbf59dbc42496a405f585e7e5332d27df0403be7488fd7de791f00afc82ecb6590c0d7bd
@@ -1,3 +1,10 @@
1
+ === 1.3.9 / 2014-02-25
2
+
3
+ * Bugfixes:
4
+ * Reset exception message. Closes #80
5
+ * Reduce warnings due unused pointers. Closes #89
6
+ * Add BSD-3 license reference to gemspec. Refs #99 and #106
7
+
1
8
  === 1.3.8 / 2013-08-17
2
9
 
3
10
  * Enhancements:
@@ -19,6 +26,7 @@
19
26
 
20
27
  * Bugfixes
21
28
  * Closing a bad statement twice will not segv.
29
+ * Aggregate handlers are initialized on each query. Closes #44
22
30
 
23
31
  * Internal
24
32
  * Unset environment variables that could affect cross compilation.
@@ -1,6 +1,6 @@
1
1
  = SQLite3/Ruby Interface
2
2
 
3
- * http://github.com/luislavena/sqlite3-ruby
3
+ * https://github.com/sparklemotion/sqlite3-ruby
4
4
  * http://groups.google.com/group/sqlite3-ruby
5
5
 
6
6
  == DESCRIPTION
@@ -33,6 +33,10 @@ Note that this module is only compatible with SQLite 3.6.16 or newer.
33
33
  }.each do |pair|
34
34
  db.execute "insert into numbers values ( ?, ? )", pair
35
35
  end
36
+
37
+ # Execute inserts with parameter markers
38
+ db.execute("INSERT INTO students (name, email, grade, blog)
39
+ VALUES (?, ?, ?, ?)", [@name, @email, @grade, @blog])
36
40
 
37
41
  # Find a few rows
38
42
  db.execute( "select * from numbers" ) do |row|
@@ -75,10 +79,10 @@ can be found here:
75
79
 
76
80
  Uh oh. After contacting the mailing list, you've found that you've actually
77
81
  discovered a bug. You can file the bug at the
78
- {github issues page}[http://github.com/luislavena/sqlite3-ruby/issues]
82
+ {github issues page}[https://github.com/sparklemotion/sqlite3-ruby/issues]
79
83
  which can be found here:
80
84
 
81
- * http://github.com/luislavena/sqlite3-ruby/issues
85
+ * https://github.com/sparklemotion/sqlite3-ruby/issues
82
86
 
83
87
  == Usage
84
88
 
@@ -91,5 +95,5 @@ FAQ, please send them to {the mailing list}[http://groups.google.com/group/sqlit
91
95
 
92
96
  The source repository is accessible via git:
93
97
 
94
- git clone git://github.com/luislavena/sqlite3-ruby.git
98
+ git clone git://github.com/sparklemotion/sqlite3-ruby.git
95
99
 
@@ -308,13 +308,16 @@ static void set_sqlite3_func_result(sqlite3_context * ctx, VALUE result)
308
308
  case T_FIXNUM:
309
309
  sqlite3_result_int64(ctx, (sqlite3_int64)FIX2LONG(result));
310
310
  break;
311
- case T_BIGNUM:
311
+ case T_BIGNUM: {
312
312
  #if SIZEOF_LONG < 8
313
- if (RBIGNUM_LEN(result) * SIZEOF_BDIGITS <= 8) {
314
- sqlite3_result_int64(ctx, NUM2LL(result));
315
- break;
313
+ sqlite3_int64 num64;
314
+
315
+ if (bignum_to_int64(result, &num64)) {
316
+ sqlite3_result_int64(ctx, num64);
317
+ break;
316
318
  }
317
319
  #endif
320
+ }
318
321
  case T_FLOAT:
319
322
  sqlite3_result_double(ctx, NUM2DBL(result));
320
323
  break;
@@ -24,8 +24,9 @@ def asplode missing
24
24
  "http://www.sqlite.org/ first."
25
25
  else
26
26
  abort <<-error
27
- #{missing} is missing. Try 'port install sqlite3 +universal'
28
- or 'yum install sqlite-devel' and check your shared library search path (the
27
+ #{missing} is missing. Try 'port install sqlite3 +universal',
28
+ 'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
29
+ and check your shared library search path (the
29
30
  location where your sqlite3 shared library is located).
30
31
  error
31
32
  end
@@ -37,6 +38,9 @@ asplode('sqlite3') unless find_library 'sqlite3', 'sqlite3_libversion_number'
37
38
  # Functions defined in 1.9 but not 1.8
38
39
  have_func('rb_proc_arity')
39
40
 
41
+ # Functions defined in 2.1 but not 2.0
42
+ have_func('rb_integer_pack')
43
+
40
44
  # These functions may not be defined
41
45
  have_func('sqlite3_initialize')
42
46
  have_func('sqlite3_backup_init')
@@ -3,6 +3,63 @@
3
3
  VALUE mSqlite3;
4
4
  VALUE cSqlite3Blob;
5
5
 
6
+ int bignum_to_int64(VALUE value, sqlite3_int64 *result)
7
+ {
8
+ #ifdef HAVE_RB_INTEGER_PACK
9
+ const int nails = 0;
10
+ int t = rb_integer_pack(value, result, 1, sizeof(*result), nails,
11
+ INTEGER_PACK_NATIVE_BYTE_ORDER|
12
+ INTEGER_PACK_2COMP);
13
+ switch (t) {
14
+ case -2: case +2:
15
+ return 0;
16
+ case +1:
17
+ if (!nails) {
18
+ if (*result < 0) return 0;
19
+ }
20
+ break;
21
+ case -1:
22
+ if (!nails) {
23
+ if (*result >= 0) return 0;
24
+ }
25
+ else {
26
+ *result += INT64_MIN;
27
+ }
28
+ break;
29
+ }
30
+ return 1;
31
+ #else
32
+ # ifndef RBIGNUM_LEN
33
+ # define RBIGNUM_LEN(x) RBIGNUM(x)->len
34
+ # endif
35
+ const long len = RBIGNUM_LEN(value);
36
+ if (len == 0) {
37
+ *result = 0;
38
+ return 1;
39
+ }
40
+ if (len > 63 / (SIZEOF_BDIGITS * CHAR_BIT) + 1) return 0;
41
+ if (len == 63 / (SIZEOF_BDIGITS * CHAR_BIT) + 1) {
42
+ const BDIGIT *digits = RBIGNUM_DIGITS(value);
43
+ BDIGIT blast = digits[len-1];
44
+ BDIGIT bmax = (BDIGIT)1UL << (63 % (CHAR_BIT * SIZEOF_BDIGITS));
45
+ if (blast > bmax) return 0;
46
+ if (blast == bmax) {
47
+ if (RBIGNUM_POSITIVE_P(value)) {
48
+ return 0;
49
+ }
50
+ else {
51
+ long i = len-1;
52
+ while (i) {
53
+ if (digits[--i]) return 0;
54
+ }
55
+ }
56
+ }
57
+ }
58
+ *result = (sqlite3_int64)NUM2LL(value);
59
+ return 1;
60
+ #endif
61
+ }
62
+
6
63
  static VALUE libversion(VALUE UNUSED(klass))
7
64
  {
8
65
  return INT2NUM(sqlite3_libversion_number());
@@ -12,13 +12,10 @@
12
12
  # define UNUSED(x) x
13
13
  #endif
14
14
 
15
- #ifndef RBIGNUM_LEN
16
- #define RBIGNUM_LEN(x) RBIGNUM(x)->len
17
- #endif
18
-
19
15
  #ifdef HAVE_RUBY_ENCODING_H
20
16
  #include <ruby/encoding.h>
21
17
 
18
+ #define USASCII_P(_obj) (rb_enc_get_index(_obj) == rb_usascii_encindex())
22
19
  #define UTF8_P(_obj) (rb_enc_get_index(_obj) == rb_utf8_encindex())
23
20
  #define UTF16_LE_P(_obj) (rb_enc_get_index(_obj) == rb_enc_find_index("UTF-16LE"))
24
21
  #define UTF16_BE_P(_obj) (rb_enc_get_index(_obj) == rb_enc_find_index("UTF-16BE"))
@@ -50,4 +47,6 @@ extern VALUE cSqlite3Blob;
50
47
  #include <exception.h>
51
48
  #include <backup.h>
52
49
 
50
+ int bignum_to_int64(VALUE big, sqlite3_int64 *result);
51
+
53
52
  #endif
@@ -112,7 +112,6 @@ static VALUE step(VALUE self)
112
112
  VALUE list;
113
113
  #ifdef HAVE_RUBY_ENCODING_H
114
114
  rb_encoding * internal_encoding;
115
- int enc_index;
116
115
  #endif
117
116
 
118
117
  Data_Get_Struct(self, sqlite3StmtRuby, ctx);
@@ -124,8 +123,7 @@ static VALUE step(VALUE self)
124
123
  #ifdef HAVE_RUBY_ENCODING_H
125
124
  {
126
125
  VALUE db = rb_iv_get(self, "@connection");
127
- VALUE encoding = rb_funcall(db, rb_intern("encoding"), 0);
128
- enc_index = NIL_P(encoding) ? rb_utf8_encindex() : rb_to_encoding_index(encoding);
126
+ rb_funcall(db, rb_intern("encoding"), 0);
129
127
  internal_encoding = rb_default_internal_encoding();
130
128
  }
131
129
  #endif
@@ -155,7 +153,7 @@ static VALUE step(VALUE self)
155
153
  (long)sqlite3_column_bytes(stmt, i)
156
154
  );
157
155
  #ifdef HAVE_RUBY_ENCODING_H
158
- rb_enc_associate_index(str, enc_index);
156
+ rb_enc_associate_index(str, rb_utf8_encindex());
159
157
  if(internal_encoding)
160
158
  str = rb_str_export_to_enc(str, internal_encoding);
161
159
  #endif
@@ -239,15 +237,22 @@ static VALUE bind_param(VALUE self, VALUE key, VALUE value)
239
237
  SQLITE_TRANSIENT
240
238
  );
241
239
  } else {
240
+
241
+
242
242
  #ifdef HAVE_RUBY_ENCODING_H
243
- if(!UTF8_P(value)) {
244
- VALUE db = rb_iv_get(self, "@connection");
245
- VALUE encoding = rb_funcall(db, rb_intern("encoding"), 0);
246
- rb_encoding * enc = rb_to_encoding(encoding);
247
- value = rb_str_export_to_enc(value, enc);
243
+ if (UTF16_LE_P(value)) {
244
+ status = sqlite3_bind_text16(
245
+ ctx->st,
246
+ index,
247
+ (const char *)StringValuePtr(value),
248
+ (int)RSTRING_LEN(value),
249
+ SQLITE_TRANSIENT
250
+ );
251
+ } else {
252
+ if (!UTF8_P(value) || !USASCII_P(value)) {
253
+ value = rb_str_encode(value, rb_enc_from_encoding(rb_utf8_encoding()), 0, Qnil);
248
254
  }
249
255
  #endif
250
-
251
256
  status = sqlite3_bind_text(
252
257
  ctx->st,
253
258
  index,
@@ -255,13 +260,18 @@ static VALUE bind_param(VALUE self, VALUE key, VALUE value)
255
260
  (int)RSTRING_LEN(value),
256
261
  SQLITE_TRANSIENT
257
262
  );
263
+ #ifdef HAVE_RUBY_ENCODING_H
264
+ }
265
+ #endif
258
266
  }
259
267
  break;
260
- case T_BIGNUM:
261
- if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
262
- status = sqlite3_bind_int64(ctx->st, index, (sqlite3_int64)NUM2LL(value));
268
+ case T_BIGNUM: {
269
+ sqlite3_int64 num64;
270
+ if (bignum_to_int64(value, &num64)) {
271
+ status = sqlite3_bind_int64(ctx->st, index, num64);
263
272
  break;
264
273
  }
274
+ }
265
275
  case T_FLOAT:
266
276
  status = sqlite3_bind_double(ctx->st, index, NUM2DBL(value));
267
277
  break;
@@ -290,12 +300,11 @@ static VALUE bind_param(VALUE self, VALUE key, VALUE value)
290
300
  static VALUE reset_bang(VALUE self)
291
301
  {
292
302
  sqlite3StmtRubyPtr ctx;
293
- int status;
294
303
 
295
304
  Data_Get_Struct(self, sqlite3StmtRuby, ctx);
296
305
  REQUIRE_OPEN_STMT(ctx);
297
306
 
298
- status = sqlite3_reset(ctx->st);
307
+ sqlite3_reset(ctx->st);
299
308
 
300
309
  ctx->done_p = 0;
301
310
 
@@ -310,12 +319,11 @@ static VALUE reset_bang(VALUE self)
310
319
  static VALUE clear_bindings(VALUE self)
311
320
  {
312
321
  sqlite3StmtRubyPtr ctx;
313
- int status;
314
322
 
315
323
  Data_Get_Struct(self, sqlite3StmtRuby, ctx);
316
324
  REQUIRE_OPEN_STMT(ctx);
317
325
 
318
- status = sqlite3_clear_bindings(ctx->st);
326
+ sqlite3_clear_bindings(ctx->st);
319
327
 
320
328
  ctx->done_p = 0;
321
329
 
@@ -331,7 +331,7 @@
331
331
  p obj == h
332
332
  </pre>
333
333
 
334
- - "How do insert binary data into the database?": >-
334
+ - "How do I insert binary data into the database?": >-
335
335
  Use blobs. Blobs are new features of SQLite3. You have to use bind
336
336
  variables to make it work:
337
337
 
@@ -94,7 +94,7 @@ in version 2.0.0.
94
94
  begin
95
95
  yield stmt
96
96
  ensure
97
- stmt.close
97
+ stmt.close unless stmt.closed?
98
98
  end
99
99
  end
100
100
 
@@ -221,15 +221,18 @@ Support for this behavior will be removed in version 2.0.0.
221
221
  sql = sql.strip
222
222
  until sql.empty? do
223
223
  prepare( sql ) do |stmt|
224
- # FIXME: this should probably use sqlite3's api for batch execution
225
- # This implementation requires stepping over the results.
226
- if bind_vars.length == stmt.bind_parameter_count
227
- stmt.bind_params(bind_vars)
224
+ unless stmt.closed?
225
+ # FIXME: this should probably use sqlite3's api for batch execution
226
+ # This implementation requires stepping over the results.
227
+ if bind_vars.length == stmt.bind_parameter_count
228
+ stmt.bind_params(bind_vars)
229
+ end
230
+ stmt.step
228
231
  end
229
- stmt.step
230
232
  sql = stmt.remainder.strip
231
233
  end
232
234
  end
235
+ # FIXME: we should not return `nil` as a success return value
233
236
  nil
234
237
  end
235
238
 
@@ -428,6 +431,7 @@ Support for this will be removed in version 2.0.0.
428
431
  #
429
432
  # class LengthsAggregateHandler
430
433
  # def self.arity; 1; end
434
+ # def self.name; 'lengths'; end
431
435
  #
432
436
  # def initialize
433
437
  # @total = 0
@@ -446,21 +450,28 @@ Support for this will be removed in version 2.0.0.
446
450
  # puts db.get_first_value( "select lengths(name) from A" )
447
451
  def create_aggregate_handler( handler )
448
452
  proxy = Class.new do
449
- def initialize handler
450
- @handler = handler
451
- @fp = FunctionProxy.new
453
+ def initialize klass
454
+ @klass = klass
455
+ @fp = FunctionProxy.new
452
456
  end
453
457
 
454
458
  def step( *args )
455
- @handler.step(@fp, *args)
459
+ instance.step(@fp, *args)
456
460
  end
457
461
 
458
462
  def finalize
459
- @handler.finalize @fp
463
+ instance.finalize @fp
464
+ @instance = nil
460
465
  @fp.result
461
466
  end
467
+
468
+ private
469
+
470
+ def instance
471
+ @instance ||= @klass.new
472
+ end
462
473
  end
463
- define_aggregator(handler.name, proxy.new(handler.new))
474
+ define_aggregator(handler.name, proxy.new(handler))
464
475
  self
465
476
  end
466
477
 
@@ -269,9 +269,9 @@ module SQLite3
269
269
  case hash["dflt_value"]
270
270
  when /^null$/i
271
271
  hash["dflt_value"] = nil
272
- when /^'(.*)'$/
272
+ when /^'(.*)'$/m
273
273
  hash["dflt_value"] = $1.gsub(/''/, "'")
274
- when /^"(.*)"$/
274
+ when /^"(.*)"$/m
275
275
  hash["dflt_value"] = $1.gsub(/""/, '"')
276
276
  end
277
277
  end
@@ -1,12 +1,12 @@
1
1
  module SQLite3
2
2
 
3
- VERSION = '1.3.8'
3
+ VERSION = '1.3.9'
4
4
 
5
5
  module VersionProxy
6
6
 
7
7
  MAJOR = 1
8
8
  MINOR = 3
9
- TINY = 8
9
+ TINY = 9
10
10
  BUILD = nil
11
11
 
12
12
  STRING = [ MAJOR, MINOR, TINY, BUILD ].compact.join( "." )
data/setup.rb CHANGED
@@ -102,7 +102,7 @@ end
102
102
 
103
103
  class ConfigTable
104
104
 
105
- c = ::Config::CONFIG
105
+ c = ::RbConfig::CONFIG
106
106
 
107
107
  rubypath = c['bindir'] + '/' + c['ruby_install_name']
108
108
 
@@ -1219,7 +1219,7 @@ class Installer
1219
1219
  raise InstallError, "no ruby extention exists: 'ruby #{$0} setup' first"
1220
1220
  end
1221
1221
 
1222
- DLEXT = /\.#{ ::Config::CONFIG['DLEXT'] }\z/
1222
+ DLEXT = /\.#{ ::RbConfig::CONFIG['DLEXT'] }\z/
1223
1223
 
1224
1224
  def _ruby_extentions(dir)
1225
1225
  Dir.open(dir) {|d|
@@ -13,7 +13,7 @@ HOE = Hoe.spec 'sqlite3' do
13
13
  developer 'Luis Lavena', 'luislavena@gmail.com'
14
14
  developer 'Aaron Patterson', 'aaron@tenderlovemaking.com'
15
15
 
16
- license "MIT"
16
+ license "BSD-3"
17
17
 
18
18
  self.readme_file = 'README.rdoc'
19
19
  self.history_file = 'CHANGELOG.rdoc'
@@ -17,7 +17,7 @@ def define_sqlite_task(platform, host)
17
17
 
18
18
  unless File.exist?(checkpoint)
19
19
  cflags = "-O2 -DSQLITE_ENABLE_COLUMN_METADATA"
20
- cflags << " -fPIC" if recipe.host.include?("x86_64")
20
+ cflags << " -fPIC" if recipe.host && recipe.host.include?("x86_64")
21
21
  recipe.configure_options << "CFLAGS='#{cflags}'"
22
22
  recipe.cook
23
23
  touch checkpoint
@@ -60,6 +60,14 @@ module SQLite3
60
60
  assert_equal [[30]], @db.execute("select number from items")
61
61
  end
62
62
 
63
+ def test_batch_last_comment_is_processed
64
+ # FIXME: nil as a successful return value is kinda dumb
65
+ assert_nil @db.execute_batch <<-eosql
66
+ CREATE TABLE items (id integer PRIMARY KEY AUTOINCREMENT);
67
+ -- omg
68
+ eosql
69
+ end
70
+
63
71
  def test_new
64
72
  db = SQLite3::Database.new(':memory:')
65
73
  assert db
@@ -107,6 +115,15 @@ module SQLite3
107
115
  assert_instance_of(SQLite3::Statement, stmt)
108
116
  end
109
117
 
118
+ def test_block_prepare_does_not_double_close
119
+ db = SQLite3::Database.new(':memory:')
120
+ r = db.prepare('select "hello world"') do |stmt|
121
+ stmt.close
122
+ :foo
123
+ end
124
+ assert_equal :foo, r
125
+ end
126
+
110
127
  def test_total_changes
111
128
  db = SQLite3::Database.new(':memory:')
112
129
  db.execute("create table foo ( a integer primary key, b text )")
@@ -11,6 +11,38 @@ module SQLite3
11
11
  @db.execute(@create);
12
12
  end
13
13
 
14
+ def test_select_encoding_on_utf_16
15
+ str = "foo"
16
+ db = SQLite3::Database.new(':memory:'.encode('UTF-16LE'))
17
+ db.execute @create
18
+ db.execute "insert into ex (id, data) values (1, \"#{str}\")"
19
+
20
+ stmt = db.prepare 'select * from ex where data = ?'
21
+ ['US-ASCII', 'UTF-16LE', 'EUC-JP', 'UTF-8'].each do |enc|
22
+ stmt.bind_param 1, str.encode(enc)
23
+ assert_equal 1, stmt.to_a.length
24
+ stmt.reset!
25
+ end
26
+ end
27
+
28
+ def test_insert_encoding
29
+ str = "foo"
30
+ db = SQLite3::Database.new(':memory:'.encode('UTF-16LE'))
31
+ db.execute @create
32
+ stmt = db.prepare @insert
33
+
34
+ ['US-ASCII', 'UTF-16LE', 'UTF-16BE', 'EUC-JP', 'UTF-8'].each_with_index do |enc,i|
35
+ stmt.bind_param 1, i
36
+ stmt.bind_param 2, str.encode(enc)
37
+ stmt.to_a
38
+ stmt.reset!
39
+ end
40
+
41
+ db.execute('select data from ex').flatten.each do |s|
42
+ assert_equal str, s
43
+ end
44
+ end
45
+
14
46
  def test_default_internal_is_honored
15
47
  warn_before = $-w
16
48
  $-w = false
@@ -21,12 +21,14 @@ class TC_Database_Integration < SQLite3::TestCase
21
21
 
22
22
  def test_table_info_with_defaults_for_version_3_3_8_and_higher
23
23
  @db.transaction do
24
- @db.execute "create table defaults_test ( a string default NULL, b string default 'Hello' )"
24
+ @db.execute "create table defaults_test ( a string default NULL, b string default 'Hello', c string default '--- []\n' )"
25
25
  data = @db.table_info( "defaults_test" )
26
26
  assert_equal({"name" => "a", "type" => "string", "dflt_value" => nil, "notnull" => 0, "cid" => 0, "pk" => 0},
27
27
  data[0])
28
28
  assert_equal({"name" => "b", "type" => "string", "dflt_value" => "Hello", "notnull" => 0, "cid" => 1, "pk" => 0},
29
29
  data[1])
30
+ assert_equal({"name" => "c", "type" => "string", "dflt_value" => "--- []\n", "notnull" => 0, "cid" => 2, "pk" => 0},
31
+ data[2])
30
32
  end
31
33
  end
32
34
 
@@ -236,7 +238,7 @@ class TC_Database_Integration < SQLite3::TestCase
236
238
 
237
239
  def test_execute2_with_block_with_bind_with_match
238
240
  called = 0
239
- @db.execute2( "select * from foo where a = ?", 1 ) do |row|
241
+ @db.execute2( "select * from foo where a = ?", 1 ) do
240
242
  called += 1
241
243
  end
242
244
  assert_equal 2, called
@@ -528,21 +530,36 @@ class TC_Database_Integration < SQLite3::TestCase
528
530
  assert_equal 0, value
529
531
  end
530
532
 
531
- def test_create_aggregate_handler
532
- handler = Class.new do
533
- class << self
534
- def arity; 1; end
535
- def text_rep; SQLite3::Constants::TextRep::ANY; end
536
- def name; "multiply"; end
537
- end
538
- def step(ctx, a)
539
- ctx[:buffer] ||= 1
540
- ctx[:buffer] *= a.to_i
533
+ class AggregateHandler
534
+ class << self
535
+ def arity; 1; end
536
+ def text_rep; SQLite3::Constants::TextRep::ANY; end
537
+ def name; "multiply"; end
538
+ end
539
+ def step(ctx, a)
540
+ ctx[:buffer] ||= 1
541
+ ctx[:buffer] *= a.to_i
542
+ end
543
+ def finalize(ctx); ctx.result = ctx[:buffer]; end
544
+ end
545
+
546
+ def test_aggregate_initialized_twice
547
+ initialized = 0
548
+ handler = Class.new(AggregateHandler) do
549
+ define_method(:initialize) do
550
+ initialized += 1
551
+ super()
541
552
  end
542
- def finalize(ctx); ctx.result = ctx[:buffer]; end
543
553
  end
544
554
 
545
- @db.create_aggregate_handler( handler )
555
+ @db.create_aggregate_handler handler
556
+ @db.get_first_value( "select multiply(a) from foo" )
557
+ @db.get_first_value( "select multiply(a) from foo" )
558
+ assert_equal 2, initialized
559
+ end
560
+
561
+ def test_create_aggregate_handler
562
+ @db.create_aggregate_handler AggregateHandler
546
563
  value = @db.get_first_value( "select multiply(a) from foo" )
547
564
  assert_equal 6, value
548
565
  end
@@ -69,7 +69,7 @@ class TC_Integration_Pending < SQLite3::TestCase
69
69
  end
70
70
  sleep 1
71
71
 
72
- @db.busy_handler do |count|
72
+ @db.busy_handler do
73
73
  handler_call_count += 1
74
74
  false
75
75
  end
@@ -30,7 +30,11 @@ module SQLite3
30
30
  stmt.execute('ruby')
31
31
 
32
32
  exception = assert_raises(SQLite3::ConstraintException) { stmt.execute('ruby') }
33
- assert_match /column(s)? .* (is|are) not unique/, exception.message
33
+ # SQLite 3.8.2 returns new error message:
34
+ # UNIQUE constraint failed: *table_name*.*column_name*
35
+ # Older versions of SQLite return:
36
+ # column *column_name* is not unique
37
+ assert_match /(column(s)? .* (is|are) not unique|UNIQUE constraint failed: .*)/, exception.message
34
38
  end
35
39
 
36
40
  ###
metadata CHANGED
@@ -1,131 +1,114 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: sqlite3
3
- version: !ruby/object:Gem::Version
4
- hash: 11
5
- prerelease:
6
- segments:
7
- - 1
8
- - 3
9
- - 8
10
- version: 1.3.8
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.3.9
11
5
  platform: x64-mingw32
12
- authors:
6
+ authors:
13
7
  - Jamis Buck
14
8
  - Luis Lavena
15
9
  - Aaron Patterson
16
10
  autorequire:
17
11
  bindir: bin
18
12
  cert_chain: []
19
-
20
- date: 2013-08-17 00:00:00 Z
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
23
- version_requirements: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 31
29
- segments:
30
- - 5
31
- - 0
32
- version: "5.0"
33
- name: minitest
34
- prerelease: false
35
- type: :development
36
- requirement: *id001
37
- - !ruby/object:Gem::Dependency
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 27
44
- segments:
45
- - 4
46
- - 0
47
- version: "4.0"
13
+ date: 2014-02-25 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
48
16
  name: rdoc
49
- prerelease: false
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - "~>"
20
+ - !ruby/object:Gem::Version
21
+ version: '4.0'
50
22
  type: :development
51
- requirement: *id002
52
- - !ruby/object:Gem::Dependency
53
- version_requirements: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
56
- - - ~>
57
- - !ruby/object:Gem::Version
58
- hash: 57
59
- segments:
60
- - 0
61
- - 9
62
- - 1
63
- version: 0.9.1
64
- name: rake-compiler
65
23
  prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - "~>"
27
+ - !ruby/object:Gem::Version
28
+ version: '4.0'
29
+ - !ruby/object:Gem::Dependency
30
+ name: rake-compiler
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - "~>"
34
+ - !ruby/object:Gem::Version
35
+ version: 0.9.1
66
36
  type: :development
67
- requirement: *id003
68
- - !ruby/object:Gem::Dependency
69
- version_requirements: &id004 !ruby/object:Gem::Requirement
70
- none: false
71
- requirements:
72
- - - ~>
73
- - !ruby/object:Gem::Version
74
- hash: 9
75
- segments:
76
- - 0
77
- - 5
78
- - 1
79
- version: 0.5.1
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: 0.9.1
43
+ - !ruby/object:Gem::Dependency
80
44
  name: mini_portile
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: 0.5.1
50
+ type: :development
81
51
  prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: 0.5.1
57
+ - !ruby/object:Gem::Dependency
58
+ name: minitest
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - "~>"
62
+ - !ruby/object:Gem::Version
63
+ version: '5.0'
82
64
  type: :development
83
- requirement: *id004
84
- - !ruby/object:Gem::Dependency
85
- version_requirements: &id005 !ruby/object:Gem::Requirement
86
- none: false
87
- requirements:
88
- - - ~>
89
- - !ruby/object:Gem::Version
90
- hash: 15
91
- segments:
92
- - 1
93
- - 0
94
- version: "1.0"
95
- name: hoe-bundler
96
65
  prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - "~>"
69
+ - !ruby/object:Gem::Version
70
+ version: '5.0'
71
+ - !ruby/object:Gem::Dependency
72
+ name: hoe-bundler
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '1.0'
97
78
  type: :development
98
- requirement: *id005
99
- - !ruby/object:Gem::Dependency
100
- version_requirements: &id006 !ruby/object:Gem::Requirement
101
- none: false
102
- requirements:
103
- - - ~>
104
- - !ruby/object:Gem::Version
105
- hash: 9
106
- segments:
107
- - 3
108
- - 7
109
- version: "3.7"
110
- name: hoe
111
79
  prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - "~>"
83
+ - !ruby/object:Gem::Version
84
+ version: '1.0'
85
+ - !ruby/object:Gem::Dependency
86
+ name: hoe
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - "~>"
90
+ - !ruby/object:Gem::Version
91
+ version: '3.9'
112
92
  type: :development
113
- requirement: *id006
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - "~>"
97
+ - !ruby/object:Gem::Version
98
+ version: '3.9'
114
99
  description: |-
115
100
  This module allows Ruby programs to interface with the SQLite3
116
101
  database engine (http://www.sqlite.org). You must have the
117
102
  SQLite engine installed in order to build this module.
118
-
103
+
119
104
  Note that this module is only compatible with SQLite 3.6.16 or newer.
120
- email:
105
+ email:
121
106
  - jamis@37signals.com
122
107
  - luislavena@gmail.com
123
108
  - aaron@tenderlovemaking.com
124
109
  executables: []
125
-
126
110
  extensions: []
127
-
128
- extra_rdoc_files:
111
+ extra_rdoc_files:
129
112
  - API_CHANGES.rdoc
130
113
  - CHANGELOG.rdoc
131
114
  - Manifest.txt
@@ -135,7 +118,8 @@ extra_rdoc_files:
135
118
  - ext/sqlite3/exception.c
136
119
  - ext/sqlite3/sqlite3.c
137
120
  - ext/sqlite3/statement.c
138
- files:
121
+ files:
122
+ - ".gemtest"
139
123
  - API_CHANGES.rdoc
140
124
  - CHANGELOG.rdoc
141
125
  - ChangeLog.cvs
@@ -158,6 +142,7 @@ files:
158
142
  - faq/faq.rb
159
143
  - faq/faq.yml
160
144
  - lib/sqlite3.rb
145
+ - lib/sqlite3/2.0/sqlite3_native.so
161
146
  - lib/sqlite3/constants.rb
162
147
  - lib/sqlite3/database.rb
163
148
  - lib/sqlite3/errors.rb
@@ -188,47 +173,34 @@ files:
188
173
  - test/test_sqlite3.rb
189
174
  - test/test_statement.rb
190
175
  - test/test_statement_execute.rb
191
- - .gemtest
192
- - lib/sqlite3/2.0/sqlite3_native.so
193
- homepage: http://github.com/luislavena/sqlite3-ruby
194
- licenses:
195
- - MIT
176
+ homepage: https://github.com/sparklemotion/sqlite3-ruby
177
+ licenses:
178
+ - BSD-3
179
+ metadata: {}
196
180
  post_install_message:
197
- rdoc_options:
198
- - --main
181
+ rdoc_options:
182
+ - "--main"
199
183
  - README.rdoc
200
- require_paths:
184
+ require_paths:
201
185
  - lib
202
- required_ruby_version: !ruby/object:Gem::Requirement
203
- none: false
204
- requirements:
186
+ required_ruby_version: !ruby/object:Gem::Requirement
187
+ requirements:
205
188
  - - ">="
206
- - !ruby/object:Gem::Version
207
- hash: 57
208
- segments:
209
- - 1
210
- - 8
211
- - 7
189
+ - !ruby/object:Gem::Version
212
190
  version: 1.8.7
213
- required_rubygems_version: !ruby/object:Gem::Requirement
214
- none: false
215
- requirements:
191
+ required_rubygems_version: !ruby/object:Gem::Requirement
192
+ requirements:
216
193
  - - ">="
217
- - !ruby/object:Gem::Version
218
- hash: 17
219
- segments:
220
- - 1
221
- - 3
222
- - 5
194
+ - !ruby/object:Gem::Version
223
195
  version: 1.3.5
224
196
  requirements: []
225
-
226
197
  rubyforge_project: sqlite3
227
- rubygems_version: 1.8.25
198
+ rubygems_version: 2.2.2
228
199
  signing_key:
229
- specification_version: 3
230
- summary: This module allows Ruby programs to interface with the SQLite3 database engine (http://www.sqlite.org)
231
- test_files:
200
+ specification_version: 4
201
+ summary: This module allows Ruby programs to interface with the SQLite3 database engine
202
+ (http://www.sqlite.org)
203
+ test_files:
232
204
  - test/test_backup.rb
233
205
  - test/test_collation.rb
234
206
  - test/test_database.rb