Subject Re: [ib-support] Help on Firebird Error messages!
Author Marco Bommeljé
Hi Kiran,

Kiran wrote:
>
> Hello Everyone!
>
> I am using Firebird database with few master detail tables , whenever I try
> to delete the records from the these tables I get an error
> (violation of FOREIGN KEY constraint "INTEG_55" on table "MY_MASTER_TABLE"
> ).
Have you thought of using the ON DELETE CASCADE option?

I can understand that this is related to foreign key.
> but the end user cannot. So, can we have more friendly error messages in
> Firebird ? or say Constant Error Messages ?? so that the end user can
> understand easily what he's doing wrong?. Or will I have to write on my own
> all these Error codes into user friendly messages ???

INTEG_55 is an automatically generated name. You might want to use
named constraints. In DDL, you can do this as follows:

ALTER TABLE my_table
ADD CONSTRAINT my_self_explanatory_name
FOREIGN KEY (..) REFERENCES ...

This would make error messages a little bit easier to understand.
In addition, you can create a table in which you can look up end user
messages using a constraint_name.

CREATE TABLE Constraint_Messages (
Constraint_Name CHAR(31) NOT NULL,
Constraint_Message VARCHAR(128) DEFAULT 'Invalid data detected',
CONSTRAINT Constraint_Messages_pk PRIMARY KEY (Constraint_Name));

Of course, you do not want to type in all relevant constraint names.
So you do it in one go:

INSERT INTO Constraint_Messages
SELECT rdb$constraint_name
FROM rdb$relation_constraints
WHERE rdb$relation_name NOT LIKE 'RDB%'
AND rdb$constraint_name NOT LIKE '%'

Finally, you start editing the messages as you like.

Good luck,
Marco

>
> help will be greatly appreciated!
>
> Warm Regards
> Kiran Kumar.
>
>
>
>
>
>
> *Yahoo! Groups Sponsor*
> <http://rd.yahoo.com/M=251812.3170658.4537139.1261774/D=egroupweb/S=1705115386:HM/A=1564416/R=0/*http://www.netflix.com/Default?mqso=60164797&partid=3170658>
>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
> <http://docs.yahoo.com/info/terms/>.

--
-------------------------------------
-- Marco Bommeljé
-- Bommeljé Crompvoets en partners bv
-- W: www.bcp-software.nl
-- E: mbommelj@...
-- T: +31 (0)30 2428369
-------------------------------------