Subject | Re: [ib-support] Help on Firebird Error messages! |
---|---|
Author | Marco Bommeljé |
Post date | 2003-05-07T10:08:44Z |
Hi Kiran,
Kiran wrote:
I can understand that this is related to foreign key.
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
-------------------------------------
-- Marco Bommeljé
-- Bommeljé Crompvoets en partners bv
-- W: www.bcp-software.nl
-- E: mbommelj@...
-- T: +31 (0)30 2428369
-------------------------------------
Kiran wrote:
>Have you thought of using the ON DELETE CASCADE option?
> 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"
> ).
I can understand that this is related to foreign key.
> but the end user cannot. So, can we have more friendly error messages inINTEG_55 is an automatically generated name. You might want to use
> 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 ???
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
-------------------------------------