Subject RE: [IBO] FTS not getting insert or update
Author Ólafur Guðmundsson
Hi Jason.
Here it is, sorry if it is more than you need.

/* Trigger: FTS$DAGBOK$AD_TBL */
CREATE TRIGGER FTS$DAGBOK$AD_TBL FOR TDAGBOK
ACTIVE AFTER DELETE POSITION 999
AS
BEGIN
IF (( OLD.DAATHUGASEMDIR IS NOT NULL ) AND
( OLD.DAATHUGASEMDIR <> '' )) THEN
INSERT INTO FTS$DAGBOK$Q ( FTS$DAID, FTS$Q_TYP )
VALUES( OLD.DAID, 'D' );
END
^

/* Trigger: FTS$DAGBOK$AI_TBL */
CREATE TRIGGER FTS$DAGBOK$AI_TBL FOR TDAGBOK
ACTIVE AFTER INSERT POSITION 999
AS
BEGIN
IF (( NEW.DAATHUGASEMDIR IS NOT NULL ) AND
( NEW.DAATHUGASEMDIR <> '' )) THEN
INSERT INTO FTS$DAGBOK$Q ( FTS$DAID, FTS$Q_TYP )
VALUES( NEW.DAID, 'I' );
END
^

/* Trigger: FTS$DAGBOK$AU_TBL */
CREATE TRIGGER FTS$DAGBOK$AU_TBL FOR TDAGBOK
ACTIVE AFTER UPDATE POSITION 999
AS
BEGIN
IF ((( OLD.DAATHUGASEMDIR IS NULL ) OR
( OLD.DAATHUGASEMDIR = '' )) AND
(( NEW.DAATHUGASEMDIR IS NOT NULL ) AND
( NEW.DAATHUGASEMDIR <> '' ))) THEN
INSERT INTO FTS$DAGBOK$Q ( FTS$DAID, FTS$Q_TYP )
VALUES( NEW.DAID, 'I' );
ELSE
IF ((( OLD.DAATHUGASEMDIR IS NOT NULL ) AND
( OLD.DAATHUGASEMDIR <> '' )) AND
(( NEW.DAATHUGASEMDIR IS NULL ) OR
( NEW.DAATHUGASEMDIR = '' ))) THEN
INSERT INTO FTS$DAGBOK$Q ( FTS$DAID, FTS$Q_TYP )
VALUES( NEW.DAID, 'D' );
ELSE
IF (( NEW.DAATHUGASEMDIR IS NOT NULL ) AND
( OLD.DAATHUGASEMDIR IS NOT NULL ) AND
( NEW.DAATHUGASEMDIR <> '' ) AND
( OLD.DAATHUGASEMDIR <> '' ) AND
( OLD.DAATHUGASEMDIR <>
NEW.DAATHUGASEMDIR )) THEN
INSERT INTO FTS$DAGBOK$Q ( FTS$DAID, FTS$Q_TYP )
VALUES( NEW.DAID, 'U' );
END
^

/* Trigger: TRI_TDAGBOK_L_D */
CREATE TRIGGER TRI_TDAGBOK_L_D FOR TDAGBOK
ACTIVE AFTER DELETE POSITION 32767
AS
DECLARE VARIABLE VAR_ID NUMERIC(18,0);
BEGIN
EXECUTE PROCEDURE P_INSERTINTOIBLM$OPERATIONLOG ('TDAGBOK', 'DELETE',
'DAID', OLD.DAID, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
RETURNING_VALUES :VAR_ID;
IF (OLD.DAATHUGASEMDIR IS NOT NULL) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DAATHUGASEMDIR',
NULL, NULL, OLD.DAATHUGASEMDIR, NULL);
IF (OLD.DADAGSETNING1 IS NOT NULL) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DADAGSETNING1',
OLD.DADAGSETNING1, NULL, NULL, NULL);
IF (OLD.DADAGSETNING2 IS NOT NULL) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DADAGSETNING2',
OLD.DADAGSETNING2, NULL, NULL, NULL);
IF (OLD.DADELETED IS NOT NULL) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DADELETED',
OLD.DADELETED, NULL, NULL, NULL);
IF (OLD.DAID IS NOT NULL) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DAID', OLD.DAID,
NULL, NULL, NULL);
IF (OLD.DASIDASTBREYTT IS NOT NULL) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DASIDASTBREYTT',
OLD.DASIDASTBREYTT, NULL, NULL, NULL);
IF (OLD.DASIDASTBREYTTAF IS NOT NULL) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DASIDASTBREYTTAF',
OLD.DASIDASTBREYTTAF, NULL, NULL, NULL);
IF (OLD.DATIMISKRAD IS NOT NULL) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DATIMISKRAD',
OLD.DATIMISKRAD, NULL, NULL, NULL);
IF (OLD.DAUPPHAFLEGASKRADAF IS NOT NULL) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID,
'DAUPPHAFLEGASKRADAF', OLD.DAUPPHAFLEGASKRADAF, NULL, NULL, NULL);
IF (OLD.DYID IS NOT NULL) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DYID', OLD.DYID,
NULL, NULL, NULL);
END
^

/* Trigger: TRI_TDAGBOK_L_I */
CREATE TRIGGER TRI_TDAGBOK_L_I FOR TDAGBOK
ACTIVE AFTER INSERT POSITION 32767
AS
DECLARE VARIABLE VAR_ID NUMERIC(18,0);
BEGIN
EXECUTE PROCEDURE P_INSERTINTOIBLM$OPERATIONLOG ('TDAGBOK', 'INSERT',
'DAID', NEW.DAID, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
RETURNING_VALUES :VAR_ID;
IF (NEW.DAATHUGASEMDIR IS NOT NULL) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DAATHUGASEMDIR',
NULL, NULL, NULL, NEW.DAATHUGASEMDIR);
IF (NEW.DADAGSETNING1 IS NOT NULL) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DADAGSETNING1',
NULL, NEW.DADAGSETNING1, NULL, NULL);
IF (NEW.DADAGSETNING2 IS NOT NULL) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DADAGSETNING2',
NULL, NEW.DADAGSETNING2, NULL, NULL);
IF (NEW.DADELETED IS NOT NULL) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DADELETED', NULL,
NEW.DADELETED, NULL, NULL);
IF (NEW.DAID IS NOT NULL) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DAID', NULL,
NEW.DAID, NULL, NULL);
IF (NEW.DASIDASTBREYTT IS NOT NULL) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DASIDASTBREYTT',
NULL, NEW.DASIDASTBREYTT, NULL, NULL);
IF (NEW.DASIDASTBREYTTAF IS NOT NULL) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DASIDASTBREYTTAF',
NULL, NEW.DASIDASTBREYTTAF, NULL, NULL);
IF (NEW.DATIMISKRAD IS NOT NULL) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DATIMISKRAD',
NULL, NEW.DATIMISKRAD, NULL, NULL);
IF (NEW.DAUPPHAFLEGASKRADAF IS NOT NULL) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID,
'DAUPPHAFLEGASKRADAF', NULL, NEW.DAUPPHAFLEGASKRADAF, NULL, NULL);
IF (NEW.DYID IS NOT NULL) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DYID', NULL,
NEW.DYID, NULL, NULL);
END
^

/* Trigger: TRI_TDAGBOK_L_U */
CREATE TRIGGER TRI_TDAGBOK_L_U FOR TDAGBOK
ACTIVE AFTER UPDATE POSITION 32767
AS
DECLARE VARIABLE VAR_ID NUMERIC(18,0);
BEGIN
EXECUTE PROCEDURE P_INSERTINTOIBLM$OPERATIONLOG ('TDAGBOK', 'UPDATE',
'DAID', OLD.DAID, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
RETURNING_VALUES :VAR_ID;
IF (((OLD.DAATHUGASEMDIR IS NULL) AND (NEW.DAATHUGASEMDIR IS NOT NULL)) OR
((OLD.DAATHUGASEMDIR IS NOT NULL) AND (NEW.DAATHUGASEMDIR IS NULL)) OR
(F_IBLM_BLOB_CRC(OLD.DAATHUGASEMDIR) <>
F_IBLM_BLOB_CRC(NEW.DAATHUGASEMDIR))) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DAATHUGASEMDIR',
NULL, NULL, OLD.DAATHUGASEMDIR, NEW.DAATHUGASEMDIR);
IF (((OLD.DADAGSETNING1 IS NULL) AND (NEW.DADAGSETNING1 IS NOT NULL)) OR
((OLD.DADAGSETNING1 IS NOT NULL) AND (NEW.DADAGSETNING1 IS NULL)) OR
(OLD.DADAGSETNING1 <> NEW.DADAGSETNING1)) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DADAGSETNING1',
OLD.DADAGSETNING1, NEW.DADAGSETNING1, NULL, NULL);
IF (((OLD.DADAGSETNING2 IS NULL) AND (NEW.DADAGSETNING2 IS NOT NULL)) OR
((OLD.DADAGSETNING2 IS NOT NULL) AND (NEW.DADAGSETNING2 IS NULL)) OR
(OLD.DADAGSETNING2 <> NEW.DADAGSETNING2)) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DADAGSETNING2',
OLD.DADAGSETNING2, NEW.DADAGSETNING2, NULL, NULL);
IF (((OLD.DADELETED IS NULL) AND (NEW.DADELETED IS NOT NULL)) OR
((OLD.DADELETED IS NOT NULL) AND (NEW.DADELETED IS NULL)) OR (OLD.DADELETED
<> NEW.DADELETED)) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DADELETED',
OLD.DADELETED, NEW.DADELETED, NULL, NULL);
IF (((OLD.DAID IS NULL) AND (NEW.DAID IS NOT NULL)) OR ((OLD.DAID IS NOT
NULL) AND (NEW.DAID IS NULL)) OR (OLD.DAID <> NEW.DAID)) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DAID', OLD.DAID,
NEW.DAID, NULL, NULL);
IF (((OLD.DASIDASTBREYTT IS NULL) AND (NEW.DASIDASTBREYTT IS NOT NULL)) OR
((OLD.DASIDASTBREYTT IS NOT NULL) AND (NEW.DASIDASTBREYTT IS NULL)) OR
(OLD.DASIDASTBREYTT <> NEW.DASIDASTBREYTT)) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DASIDASTBREYTT',
OLD.DASIDASTBREYTT, NEW.DASIDASTBREYTT, NULL, NULL);
IF (((OLD.DASIDASTBREYTTAF IS NULL) AND (NEW.DASIDASTBREYTTAF IS NOT
NULL)) OR ((OLD.DASIDASTBREYTTAF IS NOT NULL) AND (NEW.DASIDASTBREYTTAF IS
NULL)) OR (OLD.DASIDASTBREYTTAF <> NEW.DASIDASTBREYTTAF)) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DASIDASTBREYTTAF',
OLD.DASIDASTBREYTTAF, NEW.DASIDASTBREYTTAF, NULL, NULL);
IF (((OLD.DATIMISKRAD IS NULL) AND (NEW.DATIMISKRAD IS NOT NULL)) OR
((OLD.DATIMISKRAD IS NOT NULL) AND (NEW.DATIMISKRAD IS NULL)) OR
(OLD.DATIMISKRAD <> NEW.DATIMISKRAD)) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DATIMISKRAD',
OLD.DATIMISKRAD, NEW.DATIMISKRAD, NULL, NULL);
IF (((OLD.DAUPPHAFLEGASKRADAF IS NULL) AND (NEW.DAUPPHAFLEGASKRADAF IS NOT
NULL)) OR ((OLD.DAUPPHAFLEGASKRADAF IS NOT NULL) AND
(NEW.DAUPPHAFLEGASKRADAF IS NULL)) OR (OLD.DAUPPHAFLEGASKRADAF <>
NEW.DAUPPHAFLEGASKRADAF)) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID,
'DAUPPHAFLEGASKRADAF', OLD.DAUPPHAFLEGASKRADAF, NEW.DAUPPHAFLEGASKRADAF,
NULL, NULL);
IF (((OLD.DYID IS NULL) AND (NEW.DYID IS NOT NULL)) OR ((OLD.DYID IS NOT
NULL) AND (NEW.DYID IS NULL)) OR (OLD.DYID <> NEW.DYID)) THEN
INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID, COLUMN_NAME, OLD_VALUE,
NEW_VALUE, OLD_VALUE_BLOB, NEW_VALUE_BLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'DYID', OLD.DYID,
NEW.DYID, NULL, NULL);
END
^

regards
Oli

-----Original Message-----
From: Jason Wharton [mailto:jwharton@...]
Sent: 19. nóvember 2003 21:56
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] FTS not getting insert or update


> I am using text blobs, charset ISO8859_1 , length 8192 (don't know why I
use
> that length) and it does not work.

What triggers are created on that table?

Jason Wharton



___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/