Sha256: ed742df0a4c17c69c6c4f01394ad460efce4b9d5c9241f9e229ae51abf9f1b95

Contents?: true

Size: 845 Bytes

Versions: 25

Compression:

Stored size: 845 Bytes

Contents

require 'spec_helper'
require 'amalgalite/sqlite3'
require 'rbconfig'

describe "Amalgalite handles the JSON extension" do
  it "can parse a `json_each` call" do
    db = Amalgalite::Database.new( ":memory:" )
    values = %w[ a b c d e f g ]
    db.execute("CREATE TABLE jtest(id, json)")
    db.execute("INSERT INTO jtest(id, json) values (1, json($json))", { "$json" => values })
    rows = db.execute("SELECT jtest.id as i, value as v FROM jtest, json_each(jtest.json)")

    rows.size.should eq(values.size)
  end

  it "can return a proper json column" do
    db = Amalgalite::Database.new( ":memory:" )
    values = %w[ a b c d e f g ]
    db.execute("CREATE TABLE jtest(id INTEGER, json JSON)")
    db.execute("INSERT INTO jtest(id, json) values (1, json($json))", { "$json" => values })

    db.execute("select * from jtest")
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
amalgalite-1.9.4-x64-mingw-ucrt spec/json_spec.rb
amalgalite-1.9.4-x86-mingw32 spec/json_spec.rb
amalgalite-1.9.4-x64-mingw32 spec/json_spec.rb
amalgalite-1.9.4 spec/json_spec.rb
amalgalite-1.9.1-x86-mingw32 spec/json_spec.rb
amalgalite-1.9.1-x64-mingw32 spec/json_spec.rb
amalgalite-1.9.1-x64-mingw-ucrt spec/json_spec.rb
amalgalite-1.9.1 spec/json_spec.rb
amalgalite-1.9.0-x64-mingw-ucrt spec/json_spec.rb
amalgalite-1.9.0-x86-mingw32 spec/json_spec.rb
amalgalite-1.9.0-x64-mingw32 spec/json_spec.rb
amalgalite-1.9.0 spec/json_spec.rb
amalgalite-1.8.0-x64-mingw-ucrt spec/json_spec.rb
amalgalite-1.8.0-x64-mingw32 spec/json_spec.rb
amalgalite-1.8.0-x86-mingw32 spec/json_spec.rb
amalgalite-1.8.0 spec/json_spec.rb
amalgalite-1.7.0-x86-mingw32 spec/json_spec.rb
amalgalite-1.7.0-x64-mingw32 spec/json_spec.rb
amalgalite-1.7.0 spec/json_spec.rb
amalgalite-1.6.3-x86-mingw32 spec/json_spec.rb