Re: using TCL with sqlite database...
- From: Christian Nassau <noreply@xxxxxxxxxxxxxxxx>
- Date: Tue, 28 Nov 2006 20:44:00 +0100
Jan Van Belle wrote:
However, in the manual they recommend the first approach to the second one.
If I could use variables instead of writing out each command, it would be
much easier ;-)
Variables are also a bit safer. For example your
sqldb eval "insert into $table values ($data)"
will fail if "data" contains something unexpected like "17,19+3", whereas
sqldb eval "insert into $table values (\$data)"
would automatically escape the string correctly [note that in this case
sqlite sees "$data", not "17,19+3" as in the first case].
But the basic restriction is that you can only use variables in those
parts of your SQL where an expression is acceptable (which excludes
table names, trigger names, etc...). IMO one rarely needs such a general
insert proc as your write_sqlite_db; so far I've always been quite happy
with hard-wired table names in my sqlite-procedures.
--
=> Christian Nassau, http://www.nullhomotopie.de
.
- References:
- using TCL with sqlite database...
- From: Jan Van Belle
- Re: using TCL with sqlite database...
- From: Christian Nassau
- Re: using TCL with sqlite database...
- From: Jan Van Belle
- using TCL with sqlite database...
- Prev by Date: Re: using TCL with sqlite database...
- Next by Date: Re: proc needs to always calculate the following Saturday but fails Nov - Apr
- Previous by thread: Re: using TCL with sqlite database...
- Next by thread: Re: using TCL with sqlite database...
- Index(es):
Relevant Pages
|