Re: [sqlite] how to get notice when database is free after it was busy

2005-08-05 Thread Ray Mosley
Thanks, everyone! I understodd the "pseudo-code", Jeff!
 So what I think I'll do is:
set cnt 5
while {{[catch {db eval "my-sql-statment"} sqlerr}&&$cnt} {
 after2000
 incr cnt -1
}
 Haven't tried this, either!

 On 8/5/05, Dinsmore, Jeff <[EMAIL PROTECTED]> wrote: 
> 
> You are correct Sir! I stand corrected on all counts.
> 
> The if/else and "eval db" is what happens when you just type something
> and don't actually run it... Could definitely be confusing to a
> beginner.
> 
> I'll try to be more diligent in the future.
> 
> Thanks,
> 
> Jeff.
> 
> -Original Message-
> From: Kurt Welgehausen [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 05, 2005 5:40 PM
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] how to get notice when database is free after it
> was busy
> 
> 
> > 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"
> > }
> >
> 
> Except that you've got the if/else clauses reversed
> (or just remove the !) -- also, you don't really need
> the 'set selectResult', although it's sometimes
> convenient, because if the script succeeds, the result
> will be in the supplied variable (catchErr in this
> case) -- also, it's 'db eval', not 'eval db'.
> 
> Regards
> 
> 
> 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.
> 



-- 
Ray Mosley


RE: [sqlite] how to get notice when database is free after it was busy

2005-08-05 Thread Dinsmore, Jeff
You are correct Sir! I stand corrected on all counts.

The if/else and "eval db" is what happens when you just type something
and don't actually run it... Could definitely be confusing to a
beginner.

I'll try to be more diligent in the future.

Thanks,

Jeff.

-Original Message-
From: Kurt Welgehausen [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 05, 2005 5:40 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] how to get notice when database is free after it
was busy


> 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"
> }
>

Except that you've got the if/else clauses reversed
(or just remove the !) -- also, you don't really need
the 'set selectResult', although it's sometimes
convenient, because if the script succeeds, the result
will be in the supplied variable (catchErr in this
case) -- also, it's 'db eval', not 'eval db'.

Regards


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.


Re: [sqlite] how to get notice when database is free after it was busy

2005-08-05 Thread Kurt Welgehausen
> 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"
> }
>

Except that you've got the if/else clauses reversed
(or just remove the !) -- also, you don't really need
the 'set selectResult', although it's sometimes
convenient, because if the script succeeds, the result
will be in the supplied variable (catchErr in this
case) -- also, it's 'db eval', not 'eval db'.

Regards


RE: [sqlite] how to get notice when database is free after it was busy

2005-08-05 Thread Dinsmore, Jeff


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 
...
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.


Re: [sqlite] how to get notice when database is free after it was busy

2005-08-05 Thread Ray Mosley
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 
...
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


Re: [sqlite] how to get notice when database is free after it was busy

2005-08-04 Thread Jay Sprenkle
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.