amalgalite 1.6.0-x64-mingw32 → 1.6.1-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7a0210ab2535ac286a631657b464dbb44b27ee2
4
- data.tar.gz: d22531bbb1a391e5de2992bd805c4feb8f93e455
3
+ metadata.gz: 1c85c1701fabb68443a5d15b0b76063ea02abf5c
4
+ data.tar.gz: 06c745c15693bb48c30747a494794ba8cf167058
5
5
  SHA512:
6
- metadata.gz: 1edcc6be7b5ee62f1768c683b62424632f819b904ccf7e3d8195abe0a58ae66d4905f65c26c0c85baca9dd569da43ff7a96b5846d9e1d0ac1d5e8a6971832a19
7
- data.tar.gz: 318501523734d281dea00333d4d896e336293a05dd9bad85cf3bc8feab9e38b5f05d28dc7728ca661b3ff4ceb796ba3244ff16d179e76a7f46fbe2316ad2e7f7
6
+ metadata.gz: 8ed97b8bfcc10f3e7f1fe73d27a8ccc382cf3608c6451e02ccb1d14ce5b3c828df69b15ef32234841a544b9d38de72f1c217695a14db75f235028106511e4cd2
7
+ data.tar.gz: 41b6c450bd2834c805e311ac39e4c849f0d921338df1f3c6aa9c40c07accf8675d0a3595f37952456702ecf11cd04bc48603126cfed9c846a56680ac46d3d87c
data/HISTORY.md CHANGED
@@ -1,4 +1,7 @@
1
1
  # Amalgalite Changelog
2
+ ## Version 1.6.1 - 2018-01-02
3
+
4
+ * Fix bug when using the `json` extension
2
5
 
3
6
  ## Version 1.6.0 - 2017-12-13
4
7
 
@@ -80,6 +80,7 @@ spec/default_map_spec.rb
80
80
  spec/function_spec.rb
81
81
  spec/integeration_spec.rb
82
82
  spec/iso_3166_database.rb
83
+ spec/json_spec.rb
83
84
  spec/packer_spec.rb
84
85
  spec/paths_spec.rb
85
86
  spec/progress_handler_spec.rb
@@ -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
- column_schema = @db.schema.tables[table_name].columns[column_name]
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
  }
@@ -4,5 +4,5 @@
4
4
  #++
5
5
 
6
6
  module Amalgalite
7
- VERSION = "1.6.0"
7
+ VERSION = "1.6.1"
8
8
  end
@@ -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.0
4
+ version: 1.6.1
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Jeremy Hinegardner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-13 00:00:00.000000000 Z
11
+ date: 2018-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arrayfields
@@ -229,6 +229,7 @@ files:
229
229
  - spec/function_spec.rb
230
230
  - spec/integeration_spec.rb
231
231
  - spec/iso_3166_database.rb
232
+ - spec/json_spec.rb
232
233
  - spec/packer_spec.rb
233
234
  - spec/paths_spec.rb
234
235
  - spec/progress_handler_spec.rb
@@ -298,6 +299,7 @@ test_files:
298
299
  - spec/function_spec.rb
299
300
  - spec/integeration_spec.rb
300
301
  - spec/iso_3166_database.rb
302
+ - spec/json_spec.rb
301
303
  - spec/packer_spec.rb
302
304
  - spec/paths_spec.rb
303
305
  - spec/progress_handler_spec.rb