Subject | Re: [IBO] Replicating blobs with triggers |
---|---|
Author | Helen Borrie |
Post date | 2006-12-05T23:47:44Z |
At 05:48 AM 6/12/2006, you wrote:
are created with a temporary ID earmarked for association with the
blob ID that will be created for your blob field during the window
between BEFORE and AFTER events at the server.
Replacing this with an AFTER INSERT trigger has a better chance of
success. However, messing around with blobs in triggers requires you
to be very conservative in your operations. Try to engineer any kind
of DML operation involving a blob so that the record[s] concerned get
at most ONE hit in your transaction and are committed or rolled back
without delay.
For your future reference, knife-and-fork questions regarding how the
database engine works are off-topic in this list unless they have a
bearing on some issue you're encountering with IB Objects. Therefore,
if you are likely to have further non-IBO-related questions, please
post them in firebird-support (or the appropriate Borland newsgroup,
if you are using InterBase).
Helen
>Hi all,If you do this in the BEFORE INSERT, no blob ID is available. Blobs
>
>here is my replication sql:
>
>-- "Data" is a custom blob field, declared as "Data BLOB SUB_TYPE -5"
>
>CREATE TRIGGER "trig" FOR "table" ACTIVE BEFORE INSERT POSITION 0 AS
>BEGIN
>INSERT INTO "shadowtable"
>("Name","Data")
>VALUES
>('NEW."Name",New."Data");
>END;'
>
>My problem is that the data inserted in the shadow table remains NULL.
>What am I missing?
are created with a temporary ID earmarked for association with the
blob ID that will be created for your blob field during the window
between BEFORE and AFTER events at the server.
Replacing this with an AFTER INSERT trigger has a better chance of
success. However, messing around with blobs in triggers requires you
to be very conservative in your operations. Try to engineer any kind
of DML operation involving a blob so that the record[s] concerned get
at most ONE hit in your transaction and are committed or rolled back
without delay.
For your future reference, knife-and-fork questions regarding how the
database engine works are off-topic in this list unless they have a
bearing on some issue you're encountering with IB Objects. Therefore,
if you are likely to have further non-IBO-related questions, please
post them in firebird-support (or the appropriate Borland newsgroup,
if you are using InterBase).
Helen