Skip to content

Commit

Permalink
Merge pull request #152 from tigertoes/json
Browse files Browse the repository at this point in the history
- Enable JSON1 extension for SQLite (#152, @TigerToes).
  • Loading branch information
krlmlr authored Sep 7, 2016
2 parents ce88dc9 + a224389 commit 9df3b0a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Makevars
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ PKG_CPPFLAGS=-DRSQLITE_USE_BUNDLED_SQLITE \
-DSQLITE_ENABLE_FTS3 \
-DSQLITE_ENABLE_FTS3_PARENTHESIS \
-DSQLITE_ENABLE_FTS5 \
-DSQLITE_ENABLE_JSON1 \
-DSQLITE_SOUNDEX

PKG_LIBS = sqlite3/extension-functions.o sqlite3/sqlite3.o
Expand Down
10 changes: 10 additions & 0 deletions tests/testthat/test-json.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
context("dbJson")

test_that("JSON types function", {
con <- dbConnect(SQLite())
gotJson <- dbGetQuery(con, 'SELECT json(\'{"this":"is","a":["test"]}\')')
expect_that(gotJson[1,], equals('{"this":"is","a":["test"]}'))

jsonArray <- dbGetQuery(con, 'SELECT json_array(1,2,3,4)')
expect_that(jsonArray[1,], equals('[1,2,3,4]'))
})

0 comments on commit 9df3b0a

Please sign in to comment.