amalgalite 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/HISTORY.md +3 -0
- data/Manifest.txt +1 -0
- data/lib/amalgalite/statement.rb +5 -2
- data/lib/amalgalite/type_maps/default_map.rb +1 -1
- data/lib/amalgalite/version.rb +1 -1
- data/spec/json_spec.rb +24 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69f5cacb917ac97cf9f0482a4e4df09e8a689007
|
4
|
+
data.tar.gz: 7816dc701780edf5caf2e9bfd9901622fed569ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb0930af1fc9c2b8a43a7471883048ff6e4f03be3e5650282fe40431bd17e1f6e1d693126623bdc331b8aa60e839f1a084852045078a7d5b418f109f086996d8
|
7
|
+
data.tar.gz: 7da4a872b1aad6be00b342c8c099494515e6afdfc879813e429223866cb6d1983e3430828ea38bec063f93f7db60a7649c2e7ddf128404285ddaca8b3a0fa1a4
|
data/HISTORY.md
CHANGED
data/Manifest.txt
CHANGED
data/lib/amalgalite/statement.rb
CHANGED
@@ -347,7 +347,7 @@ module Amalgalite
|
|
347
347
|
# only check for rowid if we have a table name and it is not one of the
|
348
348
|
# sqlite_master tables. We could get recursion in those cases.
|
349
349
|
if not using_rowid_column? and tbl_name and
|
350
|
-
not %w[ sqlite_master sqlite_temp_master].include?( tbl_name ) and is_column_rowid?( tbl_name, col_name ) then
|
350
|
+
not %w[ sqlite_master sqlite_temp_master ].include?( tbl_name ) and is_column_rowid?( tbl_name, col_name ) then
|
351
351
|
@rowid_index = idx
|
352
352
|
end
|
353
353
|
|
@@ -363,7 +363,10 @@ module Amalgalite
|
|
363
363
|
# is the column indicated by the Column a 'rowid' column
|
364
364
|
#
|
365
365
|
def is_column_rowid?( table_name, column_name )
|
366
|
-
|
366
|
+
table_schema = @db.schema.tables[table_name]
|
367
|
+
return false unless table_schema
|
368
|
+
|
369
|
+
column_schema = table_schema.columns[column_name]
|
367
370
|
if column_schema then
|
368
371
|
if column_schema.primary_key? and column_schema.declared_data_type and column_schema.declared_data_type.upcase == "INTEGER" then
|
369
372
|
return true
|
@@ -23,7 +23,7 @@ module Amalgalite::TypeMaps
|
|
23
23
|
'time' => %w[ timestamp time ],
|
24
24
|
'float' => %w[ double float real numeric decimal ],
|
25
25
|
'integer' => %w[ integer tinyint smallint int int2 int4 int8 bigint serial bigserial ],
|
26
|
-
'string' => %w[ text char string varchar character ],
|
26
|
+
'string' => %w[ text char string varchar character json ],
|
27
27
|
'boolean' => %w[ bool boolean ],
|
28
28
|
'blob' => %w[ binary blob ],
|
29
29
|
}
|
data/lib/amalgalite/version.rb
CHANGED
data/spec/json_spec.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'amalgalite/sqlite3'
|
3
|
+
require 'rbconfig'
|
4
|
+
|
5
|
+
describe "Amalgalite handles the JSON extension" do
|
6
|
+
it "can parse a `json_each` call" do
|
7
|
+
db = Amalgalite::Database.new( ":memory:" )
|
8
|
+
values = %w[ a b c d e f g ]
|
9
|
+
db.execute("CREATE TABLE jtest(id, json)")
|
10
|
+
db.execute("INSERT INTO jtest(id, json) values (1, json($json))", { "$json" => values })
|
11
|
+
rows = db.execute("SELECT jtest.id as i, value as v FROM jtest, json_each(jtest.json)")
|
12
|
+
|
13
|
+
rows.size.should eq(values.size)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "can return a proper json column" do
|
17
|
+
db = Amalgalite::Database.new( ":memory:" )
|
18
|
+
values = %w[ a b c d e f g ]
|
19
|
+
db.execute("CREATE TABLE jtest(id INTEGER, json JSON)")
|
20
|
+
db.execute("INSERT INTO jtest(id, json) values (1, json($json))", { "$json" => values })
|
21
|
+
|
22
|
+
db.execute("select * from jtest")
|
23
|
+
end
|
24
|
+
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.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Hinegardner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: arrayfields
|
@@ -225,6 +225,7 @@ files:
|
|
225
225
|
- spec/function_spec.rb
|
226
226
|
- spec/integeration_spec.rb
|
227
227
|
- spec/iso_3166_database.rb
|
228
|
+
- spec/json_spec.rb
|
228
229
|
- spec/packer_spec.rb
|
229
230
|
- spec/paths_spec.rb
|
230
231
|
- spec/progress_handler_spec.rb
|
@@ -271,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
271
272
|
version: '0'
|
272
273
|
requirements: []
|
273
274
|
rubyforge_project:
|
274
|
-
rubygems_version: 2.6.
|
275
|
+
rubygems_version: 2.6.13
|
275
276
|
signing_key:
|
276
277
|
specification_version: 4
|
277
278
|
summary: Amalgalite embeds the SQLite database engine in a ruby extension. There
|
@@ -291,6 +292,7 @@ test_files:
|
|
291
292
|
- spec/function_spec.rb
|
292
293
|
- spec/integeration_spec.rb
|
293
294
|
- spec/iso_3166_database.rb
|
295
|
+
- spec/json_spec.rb
|
294
296
|
- spec/packer_spec.rb
|
295
297
|
- spec/paths_spec.rb
|
296
298
|
- spec/progress_handler_spec.rb
|