SQLite.swift icon indicating copy to clipboard operation
SQLite.swift copied to clipboard

Add JSON1 support

Open augustorsouza opened this issue 7 years ago • 6 comments

Hello,

I was thinking, the support to codable as Data is great, but if we could search and use the best of JSON data structure too?

This can be achieved by json1 sqlite3 extension (see https://github.com/SMAPPNYU/smapphowto/blob/master/howto_get_going_with_sqlite_json1.md and https://www.sqlite.org/json1.html)

Best regards

augustorsouza avatar Aug 07 '18 02:08 augustorsouza

We also really need it.

Dkhusainov avatar Aug 29 '18 10:08 Dkhusainov

How could this look like? What feature do you expect from SQLite.swift?

jberkel avatar Sep 01 '18 22:09 jberkel

The first step I think is to enable this sqlite feature. I am not an expert on these things, but I think it is necessary to change a config: https://github.com/CocoaPods/Specs/blob/master/Specs/d/c/2/sqlite3/3.24.0/sqlite3.podspec.json (look for -DSQLITE_ENABLE_JSON1=1.

Also, I think we might discuss good apis to create columns based on json and search inside these columns (a quick reference for what is possible: https://stackoverflow.com/a/33433552/451591)

Best regards :)

augustorsouza avatar Sep 01 '18 23:09 augustorsouza

Yes, you can build a JSON1 enabled version with pod 'sqlite3/json1'. Then from SQLite.swift use normal SQL queries which use the json features.

Some extra API wrapper for these could be useful but are not strictly necessary.

jberkel avatar Sep 01 '18 23:09 jberkel

We only need it for raw sql. If this is achivable by only chanig Pod dependency config then it's great.

Dkhusainov avatar Sep 03 '18 07:09 Dkhusainov

Another vote for JSON1 (https://www.sqlite.org/json1.html) wrappers.

adammj avatar Jul 10 '19 02:07 adammj