Re: [sqlite] Feature request - Tcl variables as "value-list"s

2014-04-03 Thread Andy Goth
Thread necromancy! Back in 2007 I expressed a desire to efficiently insert a *list* of values all at once, where the entire list is contained within a single Tcl variable. The notation would be to use the variable name, prefixed with $ or :, in place of the value list, intentionally omitting

Re: [sqlite] Feature request - Tcl variables as "value-list"s

2007-10-05 Thread Scott Hess
As drh indicated, you're already doing what any quote() function would be doing, so it sounds like you're safe. My general tendency is to assume that anytime I implement something in parallel to another implementation, no matter how trivially obviously identical the implementations are, at some

Re: [sqlite] Feature request - Tcl variables as "value-list"s

2007-10-05 Thread Andy Goth
On Fri, 5 Oct 2007 09:41:27 -0700, Scott Hess wrote > On 10/5/07, Andy Goth <[EMAIL PROTECTED]> wrote: > > proc sql_expand {varname} { > >upvar 1 $varname var > >set result [list] > >foreach elem $var { > > lappend result '[string map {' ''} $elem]' > >} > >return [join

Re: [sqlite] Feature request - Tcl variables as "value-list"s

2007-10-05 Thread drh
"Scott Hess" <[EMAIL PROTECTED]> wrote: > You really should be using an SQLite-specific quote function > somewhere. But ... I don't see one in there (I'd have expected it to > be something like [db quote $arg]). You could work around it by doing > something like [db eval {select quote($arg)}],

Re: [sqlite] Feature request - Tcl variables as "value-list"s

2007-10-05 Thread drh
"Andy Goth" <[EMAIL PROTECTED]> wrote: > On Fri, 05 Oct 2007 15:20:41 +, drh wrote > > "Andy Goth" <[EMAIL PROTECTED]> wrote: > > > http://wiki.tcl.tk/2633 > > > > I suggest you go head and write a short TCL procedure to > > accomplish the same thing. > > Like this? > > proc sql_expand

Re: [sqlite] Feature request - Tcl variables as "value-list"s

2007-10-05 Thread Scott Hess
You really should be using an SQLite-specific quote function somewhere. But ... I don't see one in there (I'd have expected it to be something like [db quote $arg]). You could work around it by doing something like [db eval {select quote($arg)}], but that feels clunky. The quoting you're using

Re: [sqlite] Feature request - Tcl variables as "value-list"s

2007-10-05 Thread Andy Goth
On Fri, 05 Oct 2007 15:20:41 +, drh wrote > "Andy Goth" <[EMAIL PROTECTED]> wrote: > > http://wiki.tcl.tk/2633 > > I suggest you go head and write a short TCL procedure to > accomplish the same thing. Like this? proc sql_expand {varname} { upvar 1 $varname var set result [list]

Re: [sqlite] Feature request - Tcl variables as "value-list"s

2007-10-05 Thread drh
"Andy Goth" <[EMAIL PROTECTED]> wrote: > On Thu, 4 Oct 2007 21:35:30 -0500, Andy Goth wrote > > (See my original proposal writeup at the bottom of > > http://wiki.tcl.tk/2633 for more details.) > > I made a significant update to the bottom of said page. I'll briefly cover it > here as well.

Re: [sqlite] Feature request - Tcl variables as "value-list"s

2007-10-05 Thread Andy Goth
On Thu, 4 Oct 2007 21:35:30 -0500, Andy Goth wrote > (See my original proposal writeup at the bottom of > http://wiki.tcl.tk/2633 for more details.) I made a significant update to the bottom of said page. I'll briefly cover it here as well. Basically I revise my proposal to be less generic, to

[sqlite] Feature request - Tcl variables as "value-list"s

2007-10-04 Thread Andy Goth
(See my original proposal writeup at the bottom of http://wiki.tcl.tk/2633 for more details.) ** Feature request ** My current project would benefit from the ability to expand a Tcl variable into multiple SQL values. Quick example: $ set x {1 2 3} $ db eval {insert into xyzdata values({*}$x)}