John Machin wrote: > On 10/06/2009 4:40 AM, Jeremy Smith wrote: > >> When I run sqlite3_interrupt, it doesn't close existing file handles, >> making further searches tricky. >> > > Which handles? How do you know? What does "tricky" mean -- "difficult > but I can cope with it" or "causes an error" (if so, which?) or > something else? > I mean that it's impossible to use the same data files or SQL database file without running a new session (which means closing my GUI). So not 'tricky', but 'impossible'. >> So I wrote code which clears all normal >> file handles (fopen in shell.c), but... >> > > Have you tried calling sqlite3_finalize() on each prepared statement and > sqlite3_close() on each open connection? > I ran sqlite3_close, and that didn't do much.
So I wrote code in shell.c to close all fopen handles. After you (and someone else) replied, I edited os_win.c so a function closes the DB handle after an sqlite3_interrupt calls it. Basically, I was trying to close the *latest* handle to CreateFile when in fact the *very first* handle is the DB. So now it sets the handle, if not NULL, to the first file handle opened with CreateFile. In other words: It's now running queries without a problem, after repeated interrupts. Anyone else curious about sqlite3_interrupt on Windows, can email me. >> How do I close the database file too? It's not opened using fopen, but >> with CreateFileA (in winOpen in os_win.c) so I don't know what to call >> after calling sqlite3_interrupt. CloseHandle(global_h) just throws up an >> error. And I can't do further searches until the database file is free. >> > > _______________________________________________ > sqlite-users mailing list > [email protected] > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > By the way, I'm using SQLite by selecting script files to run, and not via a DLL so I can't close down a search in any way. Thanks everyone for their help! Jeremy. _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

