amalgalite 1.6.3-x86-mingw32 → 1.7.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -319,6 +319,24 @@ struct sqlite3_api_routines {
319
319
  void(*xDestroy)(void*));
320
320
  /* Version 3.26.0 and later */
321
321
  const char *(*normalized_sql)(sqlite3_stmt*);
322
+ /* Version 3.28.0 and later */
323
+ int (*stmt_isexplain)(sqlite3_stmt*);
324
+ int (*value_frombind)(sqlite3_value*);
325
+ /* Version 3.30.0 and later */
326
+ int (*drop_modules)(sqlite3*,const char**);
327
+ /* Version 3.31.0 and later */
328
+ sqlite3_int64 (*hard_heap_limit64)(sqlite3_int64);
329
+ const char *(*uri_key)(const char*,int);
330
+ const char *(*filename_database)(const char*);
331
+ const char *(*filename_journal)(const char*);
332
+ const char *(*filename_wal)(const char*);
333
+ /* Version 3.32.0 and later */
334
+ char *(*create_filename)(const char*,const char*,const char*,
335
+ int,const char**);
336
+ void (*free_filename)(char*);
337
+ sqlite3_file *(*database_file_object)(const char*);
338
+ /* Version 3.34.0 and later */
339
+ int (*txn_state)(sqlite3*,const char*);
322
340
  };
323
341
 
324
342
  /*
@@ -608,6 +626,23 @@ typedef int (*sqlite3_loadext_entry)(
608
626
  #define sqlite3_create_window_function sqlite3_api->create_window_function
609
627
  /* Version 3.26.0 and later */
610
628
  #define sqlite3_normalized_sql sqlite3_api->normalized_sql
629
+ /* Version 3.28.0 and later */
630
+ #define sqlite3_stmt_isexplain sqlite3_api->stmt_isexplain
631
+ #define sqlite3_value_frombind sqlite3_api->value_frombind
632
+ /* Version 3.30.0 and later */
633
+ #define sqlite3_drop_modules sqlite3_api->drop_modules
634
+ /* Version 3.31.0 and later */
635
+ #define sqlite3_hard_heap_limit64 sqlite3_api->hard_heap_limit64
636
+ #define sqlite3_uri_key sqlite3_api->uri_key
637
+ #define sqlite3_filename_database sqlite3_api->filename_database
638
+ #define sqlite3_filename_journal sqlite3_api->filename_journal
639
+ #define sqlite3_filename_wal sqlite3_api->filename_wal
640
+ /* Version 3.32.0 and later */
641
+ #define sqlite3_create_filename sqlite3_api->create_filename
642
+ #define sqlite3_free_filename sqlite3_api->free_filename
643
+ #define sqlite3_database_file_object sqlite3_api->database_file_object
644
+ /* Version 3.34.0 and later */
645
+ #define sqlite3_txn_state sqlite3_api->txn_state
611
646
  #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
612
647
 
613
648
  #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
@@ -13,6 +13,7 @@ module Amalgalite
13
13
  # implementation you must:
14
14
  #
15
15
  # * implement _initalize_ with 0 arguments
16
+ # * call super() in your _initialize_ method
16
17
  # * set the @arity data member
17
18
  # * set the @name data member
18
19
  # * implement _step_ with arity of +@arity+
@@ -25,6 +26,7 @@ module Amalgalite
25
26
  # attr_accessor :words
26
27
  #
27
28
  # def initialize
29
+ # super
28
30
  # @name = 'unique_word_count'
29
31
  # @arity = 1
30
32
  # @words = Hash.new { |h,k| h[k] = 0 }
@@ -50,6 +52,10 @@ module Amalgalite
50
52
  # The arity of the SQL function
51
53
  attr_accessor :arity
52
54
 
55
+ def initialize
56
+ @_exception = nil
57
+ end
58
+
53
59
  # finalize should return the final value of the aggregate function
54
60
  def finalize
55
61
  raise NotImplementedError, "Aggregate#finalize must be implemented"
@@ -22,7 +22,7 @@ module Amalgalite
22
22
  def run
23
23
  @database.transaction do |db|
24
24
  db.prepare( insert_sql ) do |stmt|
25
- ::CSV.foreach( @csv_path, @options ) do |row|
25
+ ::CSV.foreach( @csv_path, **@options ) do |row|
26
26
  stmt.execute( row )
27
27
  end
28
28
  end
@@ -339,7 +339,6 @@ module Amalgalite
339
339
  #
340
340
  def clear_taps!
341
341
  self.trace_tap = nil
342
- self.profile_tap = nil
343
342
  end
344
343
 
345
344
  ##
@@ -393,20 +392,19 @@ module Amalgalite
393
392
  #
394
393
  # db.trace_tap = nil
395
394
  #
396
- # This will unregistere the trace tap
395
+ # This will unregister the trace tap
397
396
  #
398
397
  #
399
398
  def trace_tap=( tap_obj )
400
399
 
401
400
  # unregister any previous trace tap
402
401
  #
403
- unless @trace_tap.nil?
402
+ if !@trace_tap.nil? then
404
403
  @trace_tap.trace( 'unregistered as trace tap' )
405
404
  @trace_tap = nil
406
405
  end
407
406
  return @trace_tap if tap_obj.nil?
408
407
 
409
-
410
408
  # wrap the tap if we need to
411
409
  #
412
410
  if tap_obj.respond_to?( 'trace' ) then
@@ -424,55 +422,6 @@ module Amalgalite
424
422
  @trace_tap.trace( 'registered as trace tap' )
425
423
  end
426
424
 
427
-
428
- ##
429
- # call-seq:
430
- # db.profile_tap = obj
431
- #
432
- # Register a profile tap.
433
- #
434
- # Registering a profile tap means that the +obj+ registered will have its
435
- # +profile+ method called with an Integer and a String parameter every time
436
- # a profile event happens. The Integer is the number of nanoseconds it took
437
- # for the String (SQL) to execute in wall-clock time.
438
- #
439
- # That is, every time a profile event happens in SQLite the following is
440
- # invoked:
441
- #
442
- # obj.profile( str, int )
443
- #
444
- # For instance:
445
- #
446
- # db.profile_tap = Amalgalite::ProfileTap.new( logger, 'debug' )
447
- #
448
- # This will register an instance of ProfileTap, which wraps an logger object.
449
- # On each +profile+ event the ProfileTap#profile method will be called
450
- # which in turn will call <tt>logger.debug<tt> with a formatted string containing
451
- # the String and Integer from the profile event.
452
- #
453
- # db.profile_tap = nil
454
- #
455
- # This will unregister the profile tap
456
- #
457
- #
458
- def profile_tap=( tap_obj )
459
-
460
- # unregister any previous profile tap
461
- unless @profile_tap.nil?
462
- @profile_tap.profile( 'unregistered as profile tap', 0.0 )
463
- @profile_tap = nil
464
- end
465
- return @profile_tap if tap_obj.nil?
466
-
467
- if tap_obj.respond_to?( 'profile' ) then
468
- @profile_tap = tap_obj
469
- else
470
- raise Amalgalite::Error, "#{tap_obj.class.name} cannot be used to tap. It has no 'profile' method"
471
- end
472
- @api.register_profile_tap( @profile_tap )
473
- @profile_tap.profile( 'registered as profile tap', 0.0 )
474
- end
475
-
476
425
  ##
477
426
  # call-seq:
478
427
  # db.type_map = DefaultMap.new
@@ -120,8 +120,8 @@ module Amalgalite
120
120
  # time information.
121
121
  #
122
122
  def profile( msg, time )
123
- unless sampler = @samplers[msg]
124
- msg = msg.gsub(/\s+/,' ')
123
+ msg = msg.gsub(/\s+/,' ')
124
+ unless sampler = @samplers[msg]
125
125
  sampler = @samplers[msg] = ProfileSampler.new( msg )
126
126
  end
127
127
  sampler.sample( time )
@@ -9,7 +9,7 @@ require 'stringio'
9
9
  module Amalgalite
10
10
  module Taps
11
11
  #
12
- # An IOTap is an easy way to send all top information to andy IO based
12
+ # An IOTap is an easy way to send all top information to any IO based
13
13
  # object. Both profile and trace tap information can be captured
14
14
  # This means you can send the events to STDOUT with:
15
15
  #
@@ -20,14 +20,17 @@ module Amalgalite
20
20
 
21
21
  attr_reader :profile_tap
22
22
  attr_reader :io
23
+ attr_reader :trace_count
23
24
 
24
25
  def initialize( io )
25
26
  @io = io
26
27
  @profile_tap = ProfileTap.new( self, 'output_profile_event' )
28
+ @trace_count = 0
27
29
  end
28
30
 
29
31
  def trace( msg )
30
- io.puts msg
32
+ @trace_count += 1
33
+ io.puts msg
31
34
  end
32
35
 
33
36
  # need a profile method, it routes through the profile tap which calls back
@@ -19,7 +19,7 @@ module Amalgalite
19
19
  attr_reader :delegate_method
20
20
 
21
21
  def initialize( wrapped_obj, send_to = 'trace' )
22
- unless wrapped_obj.respond_to?( send_to )
22
+ unless wrapped_obj.respond_to?( send_to )
23
23
  raise Amalgalite::Error, "#{wrapped_obj.class.name} does not respond to #{send_to.to_s} "
24
24
  end
25
25
 
@@ -4,5 +4,5 @@
4
4
  #++
5
5
 
6
6
  module Amalgalite
7
- VERSION = "1.6.3"
7
+ VERSION = "1.7.0"
8
8
  end
@@ -2,6 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  class AggregateTest1 < ::Amalgalite::Aggregate
4
4
  def initialize
5
+ super
5
6
  @name = 'atest1'
6
7
  @arity = -1
7
8
  @count = 0
@@ -96,6 +97,7 @@ describe "Aggregate SQL Functions" do
96
97
  it "handles an error being thrown during the step function" do
97
98
  class AggregateTest5 < AggregateTest1
98
99
  def initialize
100
+ super
99
101
  @name = "atest5"
100
102
  @arity = -1
101
103
  @count = 0
@@ -117,6 +119,7 @@ describe "Aggregate SQL Functions" do
117
119
  it "handles an error being thrown during the finalize function" do
118
120
  class AggregateTest6 < AggregateTest1
119
121
  def initialize
122
+ super
120
123
  @name = "atest6"
121
124
  @count = 0
122
125
  @arity = -1
@@ -131,6 +134,7 @@ describe "Aggregate SQL Functions" do
131
134
 
132
135
  it "handles an error being thrown during initialization in the C extension" do
133
136
  class AggregateTest7 < AggregateTest1
137
+ @called = false
134
138
  def self.called?
135
139
  if @called then
136
140
  raise "Initialization error!"
@@ -119,9 +119,13 @@ describe Amalgalite::Database do
119
119
  sql = "CREATE TABLE trace_test( x, y, z)"
120
120
  s = db.trace_tap = ::Amalgalite::Taps::StringIO.new
121
121
  db.execute( sql )
122
- db.trace_tap.string.should eql("registered as trace tap\n#{sql}\n")
122
+ escaped_sql= Regexp.quote(sql)
123
+ db.trace_tap.string.should match(/registered as trace tap/)
124
+ db.trace_tap.string.should match(/#{escaped_sql}/)
125
+ s.trace_count.should eql(2)
123
126
  db.trace_tap = nil
124
- s.string.should eql("registered as trace tap\n#{sql}\nunregistered as trace tap\n")
127
+ s.trace_count.should eql(3)
128
+ s.string.should match(/unregistered as trace tap/)
125
129
  end
126
130
 
127
131
  it "raises an exception if the wrong type of object is used for tracing" do
@@ -129,18 +133,13 @@ describe Amalgalite::Database do
129
133
  lambda { db.trace_tap = Object.new }.should raise_error(Amalgalite::Error)
130
134
  end
131
135
 
132
- it "raises an exception if the wrong type of object is used for profile" do
133
- db = Amalgalite::Database.new( SpecInfo.test_db )
134
- lambda { db.profile_tap = Object.new }.should raise_error(Amalgalite::Error)
135
- end
136
-
137
136
  it "profiles the execution of code" do
138
137
  db = Amalgalite::Database.new( SpecInfo.test_db )
139
- s = db.profile_tap = ::Amalgalite::Taps::StringIO.new
138
+ s = db.trace_tap = ::Amalgalite::Taps::StringIO.new
140
139
  db.execute_batch( @schema )
141
- db.profile_tap.samplers.size.should eql(6)
142
- db.profile_tap = nil
143
- s.string.should =~ /unregistered as profile tap/m
140
+ db.trace_tap.samplers.size.should eql(5)
141
+ db.trace_tap = nil
142
+ s.string.should =~ /unregistered as trace tap/
144
143
  end
145
144
 
146
145
  it "#execute yields each row when called with a block" do
@@ -167,13 +166,11 @@ describe Amalgalite::Database do
167
166
 
168
167
  it "can clear all registered taps" do
169
168
  db = Amalgalite::Database.new( SpecInfo.test_db )
170
- s = db.profile_tap = ::Amalgalite::Taps::StringIO.new
171
- db.trace_tap = s
169
+ s = db.trace_tap = ::Amalgalite::Taps::StringIO.new
172
170
  db.execute_batch( @schema )
173
- db.profile_tap.samplers.size.should eql(6)
171
+ db.trace_tap.samplers.size.should eql(5)
174
172
  db.clear_taps!
175
173
  s.string.should =~ /unregistered as trace tap/m
176
- s.string.should =~ /unregistered as profile tap/m
177
174
  end
178
175
 
179
176
  it "allows nested transactions even if SQLite under the covers does not" do
@@ -7,21 +7,21 @@ describe "Amalgalite::SQLite3::Version" do
7
7
  expect(Amalgalite::SQLite3::Version.to_s).to match( /\d+\.\d+\.\d+/ )
8
8
  expect(Amalgalite::SQLite3::Version.runtime_version).to match( /\d+\.\d+\.\d+/ )
9
9
 
10
- Amalgalite::SQLite3::Version.to_i.should eql(3026000)
11
- Amalgalite::SQLite3::Version.runtime_version_number.should eql(3026000)
10
+ Amalgalite::SQLite3::Version.to_i.should eql(3034000)
11
+ Amalgalite::SQLite3::Version.runtime_version_number.should eql(3034000)
12
12
 
13
13
  Amalgalite::SQLite3::Version::MAJOR.should eql(3)
14
- Amalgalite::SQLite3::Version::MINOR.should eql(26)
14
+ Amalgalite::SQLite3::Version::MINOR.should eql(34)
15
15
  Amalgalite::SQLite3::Version::RELEASE.should eql(0)
16
16
  expect(Amalgalite::SQLite3::Version.to_a.size).to eql(3)
17
17
 
18
- Amalgalite::SQLite3::Version.compiled_version.should be == "3.26.0"
19
- Amalgalite::SQLite3::Version.compiled_version_number.should be == 3026000
18
+ Amalgalite::SQLite3::Version.compiled_version.should be == "3.34.0"
19
+ Amalgalite::SQLite3::Version.compiled_version_number.should be == 3034000
20
20
  Amalgalite::SQLite3::Version.compiled_matches_runtime?.should be == true
21
21
  end
22
22
 
23
23
  it "should have the sqlite3 source id" do
24
- source_id = "2018-12-01 12:34:55 bf8c1b2b7a5960c282e543b9c293686dccff272512d08865f4600fb58238b4f9"
24
+ source_id = "2020-12-01 16:14:00 a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b"
25
25
  Amalgalite::SQLite3::Version.compiled_source_id.should be == source_id
26
26
  Amalgalite::SQLite3::Version.runtime_source_id.should be == source_id
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amalgalite
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.3
4
+ version: 1.7.0
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - Jeremy Hinegardner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-19 00:00:00.000000000 Z
11
+ date: 2021-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arrayfields
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '12.0'
47
+ version: '13.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '12.0'
54
+ version: '13.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake-compiler
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '5.0'
89
+ version: '6.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '5.0'
96
+ version: '6.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: simplecov
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -282,8 +282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
282
282
  - !ruby/object:Gem::Version
283
283
  version: '0'
284
284
  requirements: []
285
- rubyforge_project:
286
- rubygems_version: 2.7.8
285
+ rubygems_version: 3.1.4
287
286
  signing_key:
288
287
  specification_version: 4
289
288
  summary: Amalgalite embeds the SQLite database engine in a ruby extension. There is