Re: using TCL with sqlite database...



In article <ekhrcm$kjj$1@xxxxxxxx>,
Jan Van Belle <janvanbelle@xxxxxxxxx> wrote:
Hello all,

I'm trying to access an SQLite database via TCL.
Creating/opening/create tables etc. succeeds when doing it in 1 procedure,
but fails when I open the db in proc open_sqlite_db {} and try to write
to it in proc write_sql_db {}

example code:

proc general_calling_procedure {} {
# sqlite library is already loaded...

open_sqlite_db
write_sqlite_db { "t_test" "some data" }
...
}

proc open_sqlite_db {} {
sqlite testdb "./my_example.db"
testdb eval { create table t_test ( dummy varchar(30) ) }
}

proc write_sqlite_db { table data } {
testdb eval { insert into $table values($data) }
}

####

If I read back the data which should have been written, there is
just nothing... Quite frustrating...
Most probably it has nothing to do with sqlite itself, just the way to
access the command 'testdb'.
That's the reason why I first try it here...
.
.
.
Invocation syntax of Tcl procedures appears to be different
from what you expect. Also, I suspect Tcl is emitting
diagnostic messages you haven't communicated to us. Does
substitution of
write_sqlite_db "t_test" "some data"
for
write_sqlite_db { "t_test" "some data" }
appear to bring you closer to your goal?
.



Relevant Pages

  • using TCL with sqlite database...
    ... I'm trying to access an SQLite database via TCL. ... Creating/opening/create tables etc. succeeds when doing it in 1 procedure, ... but fails when I open the db in proc open_sqlite_db and try to write ...
    (comp.lang.tcl)
  • Re: using TCL with sqlite database...
    ... should give you a syntax error, ... I'm trying to access an SQLite database via TCL. ... but fails when I open the db in proc open_sqlite_db and try to write ...
    (comp.lang.tcl)
  • Re: function and structures
    ... C code and i have to rewrite the code in TcL. ... is to assign to it with a set command (or some other commands such ... probably the best way is to use a Tcl array. ... Functions are declared with the proc command: ...
    (comp.lang.tcl)
  • Re: function and structures
    ... lines,, i want to implement the same in TcL. ... is to assign to it with a set command (or some other commands such ... probably the best way is to use a Tcl array. ... Functions are declared with the proc command: ...
    (comp.lang.tcl)
  • Re: Call flow - tcl - menu ivr - array as fsm? better than if?
    ... number i've dialed, execute the TCL script. ... TCL would play prompts and, in the end and if applicable, transfer the ... Router calls the tcl script that is located on a machine which is ... proc act_Setup { ...
    (comp.lang.tcl)