amalgalite 1.4.1-x86-mingw32 → 1.5.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -272,6 +272,9 @@ struct sqlite3_api_routines {
272
272
  void (*value_free)(sqlite3_value*);
273
273
  int (*result_zeroblob64)(sqlite3_context*,sqlite3_uint64);
274
274
  int (*bind_zeroblob64)(sqlite3_stmt*, int, sqlite3_uint64);
275
+ /* Version 3.9.0 and later */
276
+ unsigned int (*value_subtype)(sqlite3_value*);
277
+ void (*result_subtype)(sqlite3_context*,unsigned int);
275
278
  };
276
279
 
277
280
  /*
@@ -285,7 +288,7 @@ struct sqlite3_api_routines {
285
288
  ** the API. So the redefinition macros are only valid if the
286
289
  ** SQLITE_CORE macros is undefined.
287
290
  */
288
- #ifndef SQLITE_CORE
291
+ #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
289
292
  #define sqlite3_aggregate_context sqlite3_api->aggregate_context
290
293
  #ifndef SQLITE_OMIT_DEPRECATED
291
294
  #define sqlite3_aggregate_count sqlite3_api->aggregate_count
@@ -412,6 +415,7 @@ struct sqlite3_api_routines {
412
415
  #define sqlite3_value_text16le sqlite3_api->value_text16le
413
416
  #define sqlite3_value_type sqlite3_api->value_type
414
417
  #define sqlite3_vmprintf sqlite3_api->vmprintf
418
+ #define sqlite3_vsnprintf sqlite3_api->vsnprintf
415
419
  #define sqlite3_overload_function sqlite3_api->overload_function
416
420
  #define sqlite3_prepare_v2 sqlite3_api->prepare_v2
417
421
  #define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2
@@ -507,9 +511,12 @@ struct sqlite3_api_routines {
507
511
  #define sqlite3_value_free sqlite3_api->value_free
508
512
  #define sqlite3_result_zeroblob64 sqlite3_api->result_zeroblob64
509
513
  #define sqlite3_bind_zeroblob64 sqlite3_api->bind_zeroblob64
510
- #endif /* SQLITE_CORE */
514
+ /* Version 3.9.0 and later */
515
+ #define sqlite3_value_subtype sqlite3_api->value_subtype
516
+ #define sqlite3_result_subtype sqlite3_api->result_subtype
517
+ #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
511
518
 
512
- #ifndef SQLITE_CORE
519
+ #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
513
520
  /* This case when the file really is being compiled as a loadable
514
521
  ** extension */
515
522
  # define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api=0;
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -4,5 +4,5 @@
4
4
  #++
5
5
 
6
6
  module Amalgalite
7
- VERSION = "1.4.1"
7
+ VERSION = "1.5.0"
8
8
  end
@@ -7,16 +7,16 @@ 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(3008011)
11
- Amalgalite::SQLite3::Version.runtime_version_number.should eql(3008011)
10
+ Amalgalite::SQLite3::Version.to_i.should eql(3009002)
11
+ Amalgalite::SQLite3::Version.runtime_version_number.should eql(3009002)
12
12
 
13
13
  Amalgalite::SQLite3::Version::MAJOR.should eql(3)
14
- Amalgalite::SQLite3::Version::MINOR.should eql(8)
15
- Amalgalite::SQLite3::Version::RELEASE.should eql(11)
14
+ Amalgalite::SQLite3::Version::MINOR.should eql(9)
15
+ Amalgalite::SQLite3::Version::RELEASE.should eql(2)
16
16
  expect(Amalgalite::SQLite3::Version.to_a.size).to eql(3)
17
17
 
18
- Amalgalite::SQLite3::Version.compiled_version.should be == "3.8.11.1"
19
- Amalgalite::SQLite3::Version.compiled_version_number.should be == 3008011
18
+ Amalgalite::SQLite3::Version.compiled_version.should be == "3.9.2"
19
+ Amalgalite::SQLite3::Version.compiled_version_number.should be == 3009002
20
20
  Amalgalite::SQLite3::Version.compiled_matches_runtime?.should be == true
21
21
  end
22
22
  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.4.1
4
+ version: 1.5.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: 2015-09-14 00:00:00.000000000 Z
11
+ date: 2015-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arrayfields
@@ -155,7 +155,7 @@ files:
155
155
  - examples/bootstrap.rb
156
156
  - examples/define_aggregate.rb
157
157
  - examples/define_function.rb
158
- - examples/fts3.rb
158
+ - examples/fts5.rb
159
159
  - examples/gem-db.rb
160
160
  - examples/require_me.rb
161
161
  - examples/requires.rb
data/examples/fts3.rb DELETED
@@ -1,144 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'rubygems'
3
- require 'amalgalite'
4
- require 'benchmark'
5
-
6
- begin
7
- require 'json'
8
- rescue LoadError
9
- abort "'gem install json' to run this example"
10
- end
11
-
12
-
13
- README = <<_
14
- This example programs assumes that you have downloaded the 'Tweets During the
15
- State of the Union address' dataset from infochimps.com
16
-
17
- http://www.infochimps.com/datasets/tweets-during-state-of-the-union-address
18
-
19
- Please:
20
- 1) download this dataset
21
- 2) bunzip + untar this file
22
- 3) record the location of the 'twitter_stream.txt' file that is in the
23
- tarball.
24
- 4) Pass this file as the first parameter to this script.
25
- _
26
-
27
- twitter_stream = ARGV.shift
28
- abort README unless twitter_stream and File.readable?( twitter_stream )
29
-
30
- #
31
- # Lets create a database that utilizes FTS3 http://www.sqlite.org/fts3.html
32
- #
33
- #
34
-
35
- #
36
- # Create a database, this will create the DB if it doesn't exist
37
- #
38
- puts "Opening database (version #{Amalgalite::Version})"
39
- db = Amalgalite::Database.new("fts3.db")
40
-
41
- #
42
- # Create the schema unless it already exists in the table. The meta information
43
- # about the database schema is available as the result of the db.schema method
44
- #
45
- schema = db.schema
46
- unless schema.tables['search']
47
- puts "Create schema"
48
- db.execute_batch <<-SQL
49
- CREATE VIRTUAL TABLE search USING fts3(
50
- filename VARCHAR(128),
51
- content TEXT
52
- );
53
-
54
- CREATE TABLE plain (
55
- filename VARCHAR(128),
56
- content TEXT
57
- );
58
- SQL
59
- db.reload_schema!
60
- end
61
-
62
- #
63
- # Only load the data if the db is empty
64
- #
65
- if db.first_value_from( "SELECT count(*) from search" ) == 0 then
66
- before = Time.now
67
- #
68
- # Load the tweets from the file passed on the commandline into the database
69
- # We just want the text and the tweet id and insert that into the database.
70
- #
71
-
72
- lines = IO.readlines( twitter_stream )
73
- idx = 0
74
-
75
- # Inserting bulk rows as a transaction is good practice with SQLite, it is
76
- # MUCH faster.
77
- db.transaction do |db_in_transaction|
78
- lines.each do |line|
79
-
80
- # quick little parse of the tweet
81
- json = JSON.parse( line )
82
- insert_data = {}
83
- insert_data[':fname'] = json['id']
84
- insert_data[':content'] = json['text']
85
-
86
- # insert into the FTS3 table
87
- db_in_transaction.prepare("INSERT INTO search( filename, content ) VALUES( :fname, :content );") do |stmt|
88
- stmt.execute( insert_data )
89
- end
90
-
91
- # insert into the normal table for comparison
92
- db_in_transaction.prepare("INSERT INTO plain( filename, content ) VALUES( :fname, :content );") do |stmt|
93
- stmt.execute( insert_data )
94
- end
95
-
96
- idx += 1
97
- print "Processed #{idx} of #{lines.size}\r"
98
- $stdout.flush
99
- end
100
- puts "Finalizing..."
101
- end
102
- puts "Took #{Time.now - before} seconds to insert #{idx} lines of #{lines.size}"
103
- puts "Done Inserting"
104
- end
105
-
106
- doc_count = db.first_value_from( "SELECT count(*) from search" )
107
-
108
- #
109
- # Now lets do some searching for some various words
110
- #
111
-
112
- %w[ president salmon thanks ].each do |word|
113
-
114
- count = 100
115
- puts
116
- puts "Searching for '#{word}' across #{doc_count} tweets"
117
- puts "=" * 60
118
-
119
- Benchmark.bm( 15 ) do |x|
120
-
121
- #
122
- # search using the fts search to get the cont of tweets with the given word
123
- #
124
- x.report('fts3: ') do
125
- db.prepare( "SELECT count(filename) FROM search WHERE content MATCH '#{word}'" ) do |stmt|
126
- count.times do
127
- stmt.execute
128
- end
129
- end
130
- end
131
-
132
- #
133
- # search using basic string matching in sqlite.
134
- #
135
- x.report('plain: ') do
136
- db.prepare( "SELECT count(filename) FROM plain WHERE content LIKE '% #{word} %'" ) do |stmt|
137
- count.times do
138
- stmt.execute
139
- end
140
- end
141
- end
142
- end
143
- end
144
-