🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.interbase.sql
5 messages
5 total messages Started by Isaac Mon, 19 May 2008 15:43
passing information to be displayed in exception ??
#309
Author: Isaac
Date: Mon, 19 May 2008 15:43
11 lines
1091 bytes
Hello,
I need to check balance and see if the balance is under zero I raise an 
exception

ex: if (bal < 0) then exception bal_err;

but I need the displayed message to be more informative for example to 
pass the current balance amount in the exception message , how I can do 
that ?

Thanks
Re: passing information to be displayed in exception ??
#310
Author: Bill Todd [TeamB]
Date: Mon, 19 May 2008 18:32
12 lines
1441 bytes
Isaac wrote:

> but I need the displayed message to be more informative for example
> to pass the current balance amount in the exception message , how I
> can do that ?

You cannot. Exceptions do not support variable data in the message. The
only workaround I know of is to insert the variable information into a
temporary table and let the client application read it from there.

-- 
Bill Todd (TeamB)
Re: passing information to be displayed in exception ??
#311
Author: Isaac
Date: Mon, 19 May 2008 18:50
17 lines
1652 bytes
Bill Todd [TeamB] wrote:
> Isaac wrote:
> 
>> but I need the displayed message to be more informative for example
>> to pass the current balance amount in the exception message , how I
>> can do that ?
> 
> You cannot. Exceptions do not support variable data in the message. The
> only workaround I know of is to insert the variable information into a
> temporary table and let the client application read it from there.
> 
Then I check if there is error (record) exists in the table, right ?

another question please, when triggers fires, when post changes or when 
committed ?

Thanks
Re: passing information to be displayed in exception ??
#312
Author: Bill Todd [TeamB]
Date: Mon, 19 May 2008 19:05
21 lines
1827 bytes
Isaac wrote:

> Then I check if there is error (record) exists in the table, right ?

Right. When your client application gets the exception it looks in the
table to get the variable information then creates the message you want
to show to users and displays the message.

> 
> another question please, when triggers fires, when post changes or
> when committed ?

Triggers fire when the record is inserted, updated or delete in the
database. Any change made by the trigger occurs in the context of the
transaction that caused the trigger to fire so other users will not see
the change made by the trigger until the transaction commits and
rolling back the transaction will roll back any changes made by the
trigger.

-- 
Bill Todd (TeamB)
Re: passing information to be displayed in exception ??
#313
Author: Isaac
Date: Mon, 19 May 2008 20:24
1 lines
1084 bytes
Many Thanks
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads