Re: [sqlite] 3.11.0: Tcl sqlite3 extension can't do variable interpolation _and_ json_extract

2017-06-11 Thread Zach C.
(To clarify, the '$.hash' as the second parameter of json_extract is specifying to extract the 'hash' attribute from the root of the JSON object stored in the json column, per https://sqlite.org/json1.html#compiling_the_json1_extension ) On Fri, Jun 9, 2017 at 9:04 PM, Zach C.

Re: [sqlite] 3.11.0: Tcl sqlite3 extension can't do variable interpolation _and_ json_extract

2017-06-11 Thread Zach C.
% mydb eval "SELECT json FROM $table WHERE json_extract(json, '\$.hash') = \$hash" % mydb eval "SELECT json FROM $table WHERE json_extract(json, '$.hash') = $hash" {{"a": "b", "hash": 244718899}} I know, I _really_ don't want Tcl interpolating $hash directly in here, but sqlite3's Tcl package

Re: [sqlite] 3.11.0: Tcl sqlite3 extension can't do variable interpolation _and_ json_extract

2017-06-11 Thread Zach C.
I did try the colon-style formatting as well, it didn't work. I didn't know about [string map], but I tried it too, no luck: % set map [dict create <> NotImportant] <> NotImportant % mydb eval [string map $map {SELECT json FROM <> WHERE json_extract(json, '$.hash') = $hash}] % On Fri, Jun 9,

Re: [sqlite] 3.11.0: Tcl sqlite3 extension can't do variable interpolation _and_ json_extract

2017-06-11 Thread Zach C.
I was partially unclear with using a constant table name here; what I actually need as well is the table name as effectively a const that I control as well. So more like mydb eval {$SELECT json FROM $table WHERE json_extract(json, '$.hash') = $someId} The problem is this will cause $table to be

Re: [sqlite] 3.11.0: Tcl sqlite3 extension can't do variable interpolation _and_ json_extract

2017-06-09 Thread Andreas Kupries
> On 6/9/17, Zach C. wrote: > > I was partially unclear with using a constant table name here; what I > > actually need as well is the table name as effectively a const that I > > control as well. So more like > > > > mydb eval {$SELECT json FROM $table WHERE json_extract(json,

Re: [sqlite] 3.11.0: Tcl sqlite3 extension can't do variable interpolation _and_ json_extract

2017-06-09 Thread Richard Hipp
On 6/9/17, Zach C. wrote: > I was partially unclear with using a constant table name here; what I > actually need as well is the table name as effectively a const that I > control as well. So more like > > mydb eval {$SELECT json FROM $table WHERE json_extract(json, '$.hash') =

Re: [sqlite] 3.11.0: Tcl sqlite3 extension can't do variable interpolation _and_ json_extract

2017-06-09 Thread Richard Hipp
On 6/9/17, Zach C. wrote: > I realize it's not the latest version, but I'm having an issue where the > moment I want the sqlite3 extension to do variable interpolation, it will > break json_extract() > > See this tclsh output: > > % mydb eval "SELECT json_extract(json, '$.hash')

[sqlite] 3.11.0: Tcl sqlite3 extension can't do variable interpolation _and_ json_extract

2017-06-09 Thread Zach C.
I realize it's not the latest version, but I'm having an issue where the moment I want the sqlite3 extension to do variable interpolation, it will break json_extract() See this tclsh output: % mydb eval "SELECT json_extract(json, '$.hash') FROM NotImportant WHERE json_extract(json, '$.hash') =