You can use:  catch {db eval "your sql here"} catchErr

Catch will return 0 (zero) for success, non-zero for failure.

So, you can use something like this:

if { ! [catch {set selectResult [eval db "select x from y where z =
'blah'"]} catchErr] } {
  puts "Failed - the error is $catchErr"
} else {
  puts "selectResult= $selectResult"
}

Happy Tcl'ing,

Jeff Dinsmore
MIS - Interfaces
Ridgeview Medical Center
[EMAIL PROTECTED]
952.442.2191 x6592


-----Original Message-----
From: Ray Mosley [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 05, 2005 1:15 PM
To: sqlite-users@sqlite.org; Jay Sprenkle
Subject: Re: [sqlite] how to get notice when database is free after it
was busy


Allow me to show my ignorance here, but I use the tcl bindings to SQLite
AND 
I am SQL-naive.
 All my stuff (so far) have been done with 

sqlite db <mydb-name>
...
db eval "insert|update|delete ..."
...

 How does one get the return code to determine that the DB is locked?
Would 
I change my call to be

set rc [db eval "insert|update|delete ..."]

Thanks for letting me go to school on your issue!
 On 8/4/05, Jay Sprenkle <[EMAIL PROTECTED]> wrote: 
> 
> On 8/3/05, Walter Meerschaert <[EMAIL PROTECTED]> wrote:
> > As a courtesy to my users, I wish to pop up a message thingy telling

> > the
> user when the program is waiting for the database to not be busy. 
> Right now
> I register a busy handler, and so I know how long I have been waiting,

> because we have the count parameter, when it is 1, I look at the
clock, when 
> the clock goes past 3 seconds or so it is time to tell the user tio
cool his 
> heels while we wait for some process to commit or rollback. As far as
I can 
> tell, there is no direct way to know when the database has begun
responding 
> again. The busy handler simply stops being called.
> >
> > Is there a direct way I fail to see? Or, perhaps there could be an
> addition to the api wherein we are told when the buy state is no more.
> Perhaps we could register a no_longer_busy_handler, which could take
the 
> same parameters as the busy handler but pass in -1 for the count.
> 
> keep trying to obtain a lock? You can set the wait time to a short 
> value and just repeat until the user cancels or it works.
> 



-- 
Ray Mosley


Ridgeview Medical Center Confidentiality Notice: This email message, including 
any attachments, is for the sole use of the intended recipient(s) and may 
contain confidential and privileged information. Any unauthorized review, use, 
disclosure or distribution is prohibited. If you are not the intended 
recipient, please contact the sender by reply email and destroy all copies of 
the original message.

Reply via email to