Re: using TCL with sqlite database...
- From: Jan Van Belle <janvanbelle@xxxxxxxxx>
- Date: Tue, 28 Nov 2006 20:34:16 +0100
Earl Greida wrote:
You might need to commit the transaction for it to take effect if you keep
the DB open. Make a seperate proc to close the DB and then see if your
data
is in the DB. I open the DB, run the query, and close the DB, each time
so I have never had this problem of data not being in the DB.
catch {
sqlite dbCmd $dataBase
dbCmd timeout 20000
set qryResult [dbCmd eval $query]
set errorCode [dbCmd errorcode]
dbCmd close
} catchResult
Hello Earl,
For the moment, this is my test-case :
load "/usr/lib/libtclsqlite3.so"
package require sqlite3
proc open_sqlite_db {} {
if { ![file exists "./my_test.db" ] } {
sqlite3 sqldb "./my_test.db"
sqldb eval { create table t_test ( dummy1 varchar(30), \
dummy2 varchar(30) ) }
} else {
sqlite3 sqldb "./my_test.db"
}
}
proc write_sqlite_db { table data } {
catch {
sqldb eval "insert into $table values ($data)"
set errorcode [sqldb errorcode]
} catchvariable
puts $catchvariable
}
proc close_sqlite_db {} {
sqldb close
}
open_sqlite_db
write_sqlite_db "t_test" "\"test_dummy7\",\"test_dummy8\""
set retddata [sqldb eval { select * from t_test } ]
close_sqlite_db
puts $retdata
exit
.... succeeds for now. However, it would be nice to see if my $retdata
is in the form of a list, and not just a flat string with everything in it.
Kind regards,
Jan
.
- References:
- using TCL with sqlite database...
- From: Jan Van Belle
- Re: using TCL with sqlite database...
- From: Earl Greida
- using TCL with sqlite database...
- Prev by Date: Re: proc needs to always calculate the following Saturday but fails Nov - Apr
- Next by Date: Re: using TCL with sqlite database...
- Previous by thread: Re: using TCL with sqlite database...
- Next by thread: Re: using TCL with sqlite database...
- Index(es):