-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
how to build go-sqlite3 to include the json feature ? #710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
That's not how Go works. There is no need to install dependencies in advance, as Go will always compile your application in full. I'm assuming that when you compiled your actual application (via |
I have fixed it by adding this line in sqlite3.go
then rebuild and install, |
same issue |
Some user want json1 but someone not. |
If many users want json1 to be the default, then I will make it the default. |
Rebuilding the source code with the functionality you want, if it's not enabled by default, seems perfectly fine to me. I don't know why it's considered a big deal. It's the same with the SQLite source itself -- not everything is on by default. Thank you, @mattn and @rittneje for providing mattn/go-sqlite3 in the first place! I recently did enable JSON support in rqlite, but only because the SQLite library that comes with Ubuntu has it enabled, so it seems mainstream enough. But still, building your own version is not a big deal IMHO. |
I agree with you here. The behaviour I noticed on my side, that made me write a post here, is as follows. I suspect it's rather go's behavioural issue. |
Notes on how to specify the json1 build tag for building to enable the json support . |
Here is my install procedure:
after build and install , I run my code like this:
// open database
database, _ := sql.Open("sqlite3", "file:test.db?cache=shared&mode=memory")
statement, _ := database.Prepare("CREATE TABLE IF NOT EXISTS people (id INTEGER PRIMARY KEY, key TEXT, value TEXT, valueJson)")
statement.Exec()
``
// INSERT data
statement, _ = database.Prepare("INSERT INTO people (key, valueJson) VALUES (?, ?)")
statement.Exec("Nic",
{"a":1, "b": "Raboy"}
)statement.Exec("Hello", `{"a":2, "b": "World"}`)
`
then I got this error
no such function: json_extract
panic: runtime error: invalid memory address or nil pointer dereference
what did I miss ?
The text was updated successfully, but these errors were encountered: