Page 1 of 1
How to catch the error "revdberr,invalid connection id&
Posted: Sat Sep 06, 2008 7:54 pm
by bangkok
I would like to suppress the error message "revdberr,invalid connection id" (for instance when the Internet connection to a remote MySQL database is down)...
I tried the solution :
Code: Select all
on errorDialog pError
answer "There was an error" && pError
end errorDialog
to "catch" the error.
Nothing happens. I still get the error message.
However, with another type of error (for instance a button that tries to select a non existent field) then it works... The error message is catched.
Of course, The Script Debug Mode is false.
So, is the error "revdberr,invalid connection id" .... a special one ?
If yes, is it possible to suppress it ?
Posted: Sat Sep 06, 2008 10:47 pm
by Mark
BKK,
Code: Select all
revExecuteSQL blablabla
put the result into rslt
if item 1 of rslt contains "revdberr" then
answer error rslt with "Okay"
else
-- rest of script
end if
Best,
Mark
Posted: Sun Sep 07, 2008 9:22 am
by bangkok
Thanks.
-Actually, I've noticed that revQueryDatabase gives a proper error message (via result) when the connection is lost (that was my concern)
-But still,
doesn't catch the error
-However, with a revExecuteSQL command, then
is working
Posted: Sun Sep 07, 2008 9:39 am
by Mark
Hi bkk,
No that is not right. If the errorDialog message is sent, you probably have a mistake in your script. Database errors are always in the result or in the it variable, depending on which command or function you are using.
Best,
Mark
Posted: Sun Sep 07, 2008 10:55 am
by bangkok
Mark wrote:
No that is not right. If the errorDialog message is sent, you probably have a mistake in your script. Database errors are always in the result or in the it variable, depending on which command or function you are using.
Indeed, I was wrong. The
was fired by a mistake in the script (not related to database)
Okay, so now it's clear. Thanks for your help.

Posted: Sun Sep 07, 2008 11:00 am
by Janschenkel
I seem to remember that the Rev team was considering 'throwing' some of the errors instead of returning them in 'it' or 'the result' - and I know that 'errorDialog' is called when there is a runtime error.
Have you tried wrapping your call to 'revExecuteSQL' in a try-catch block?
Code: Select all
on mouseUp
-- do whatever preparation here
...
try
revExecuteSQL theConnction, theQuery
catch tError
answer error "Just caught a database error:" && tError with "OK"
end try
end mouseUp
Jan Schenkel.
Posted: Sun Sep 07, 2008 1:47 pm
by bangkok
Janschenkel wrote:
Have you tried wrapping your call to 'revExecuteSQL' in a try-catch block?
Not yet. But that's a very good suggestion.
I'm in full "apprenticeship" right now... And actually I started to read stuff about "try-catch" yesterday while searching onErrorDialog infos.
I'll give it a try.
It's fascinating.
I was an old hypercard "amateur" long time ago... And I bought Runrev a few weeks ago... And since then, it's a daily marvel. No kidding.
The couple Runrev + MySQL (I start too) seems to be the total killer app.
And i start to dream about an app' in RunRev that could mimic FileMaker Pro, with a MySQL database engine.
To draw "visual" relationships between tables like in FM 7, create "report" by adding fields on a "model" should be piece of cake with RunRev.
Anyway. I don't understand why RunRev doesn't have a larger "public footprint" if I may say. Probably a marketing and PR issue.
But that's another debate.
