Hello! I've downloaded sqlite-3_3_5-tea and compiled it correctly. It
generates libsqlite335.so perfectly, but there is a problem.

I compiled it with threads (I did ./configure --enable-thread and I
checked -DTHREAD_SAFE=1 in the Makefile) but I can't write to the same
database/table at the same time. I open a transaction in one thread
and do lots of sql inserctions, then I close. While there is an opened
transaction in one thread, I can't do (insert/update/delete) anything
in another thread. I get "database is locked". Any idea?

Here is the script I used to test:
# --- BEGIN
package require Thread

load ./libsqlite335.so
sqlite3 db db

db eval "DROP TABLE tabela;"
db eval "CREATE TABLE tabela(n integer);"

set thread_id [thread::create {
 load libsqlite335.so
 sqlite3 db db
 set i 0

 db eval "BEGIN DEFERRED TRANSACTION;"

 while 1 {
   db eval "INSERT INTO tabela VALUES($i);"
   puts $i
   incr i
 }

 db eval "COMMIT TRANSACTION;"

 vwait forever
}]

set i 10000
while 1 {
 db eval "INSERT INTO tabela VALUES($i);"
 puts $i
 incr i
}
# --- END

See I'm using the Thread extension and Tcl is "thread-compiled"(?).

Any clue?

Thank you! Bye!

--
Silas Justiniano

Reply via email to