Subject | 4.5Ai - IBOQuery - EditQuery - field properties "noinsert" not working? |
---|---|
Author | G. Nau |
Post date | 2005-02-04T16:21:28Z |
Hi,
I'm just evaluating the IBObjects 4.5Ai on a simple test table "ADRESSKARTE".
It's defined with a primary key field REF type INTEGER, which is automatically filled
on insert by this trigger and generator (I use xCase 7.4 as ER designing tool):
CREATE TRIGGER T_BI_ADRESSKARTE FOR ADRESSKARTE
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
IF (new.Ref is null) THEN
new.Ref = GEN_ID(GEN_ADRESSKARTE,1);
END
Okay, my problem occurs with the INSERTSQL generated by the Query Editor
(Generate for Tables):
INSERT INTO ADRESSKARTE(
REF, /*PK*/
.....
VALUES (
:REF,
....
The insert commands are now failing, as REF is transferred as "<n> 0" (says IBO
Monitor) in the INSERTSQL statements. Then my trigger is not firing and getting me
1st insert: a record with REF = 0
2nd insert: PK key violation due to the 2nd record with REF=0 to be written
To prevent this, I defined in FieldProperties a column REF with readonly
"REF=NOINSERT".
BUT ... it's not working, the INSERTSQL is still containing the REF field.
By manually removing the two REF lines from the insertsql of IBOQuery it's working
fine.
Did I miss something here?
a.)How can I tell IBOQuery to ignore the field REF in the insertSQL?
or
b.) tell IBOQuery to send REF as <null> instead of "0", which will fire my trigger?
I also tested a manual insert into the table with IBexpert defining REF=<null> and it's
working as designed.
Thank you for your assistance.
Regards
Gunther
[Non-text portions of this message have been removed]
I'm just evaluating the IBObjects 4.5Ai on a simple test table "ADRESSKARTE".
It's defined with a primary key field REF type INTEGER, which is automatically filled
on insert by this trigger and generator (I use xCase 7.4 as ER designing tool):
CREATE TRIGGER T_BI_ADRESSKARTE FOR ADRESSKARTE
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
IF (new.Ref is null) THEN
new.Ref = GEN_ID(GEN_ADRESSKARTE,1);
END
Okay, my problem occurs with the INSERTSQL generated by the Query Editor
(Generate for Tables):
INSERT INTO ADRESSKARTE(
REF, /*PK*/
.....
VALUES (
:REF,
....
The insert commands are now failing, as REF is transferred as "<n> 0" (says IBO
Monitor) in the INSERTSQL statements. Then my trigger is not firing and getting me
1st insert: a record with REF = 0
2nd insert: PK key violation due to the 2nd record with REF=0 to be written
To prevent this, I defined in FieldProperties a column REF with readonly
"REF=NOINSERT".
BUT ... it's not working, the INSERTSQL is still containing the REF field.
By manually removing the two REF lines from the insertsql of IBOQuery it's working
fine.
Did I miss something here?
a.)How can I tell IBOQuery to ignore the field REF in the insertSQL?
or
b.) tell IBOQuery to send REF as <null> instead of "0", which will fire my trigger?
I also tested a manual insert into the table with IBexpert defining REF=<null> and it's
working as designed.
Thank you for your assistance.
Regards
Gunther
[Non-text portions of this message have been removed]