Subject Re: [IBO] Replicating blobs with triggers
Author Helen Borrie
At 05:48 AM 6/12/2006, you wrote:

>Hi all,
>here is my replication sql:
>-- "Data" is a custom blob field, declared as "Data BLOB SUB_TYPE -5"
>INSERT INTO "shadowtable"
>My problem is that the data inserted in the shadow table remains NULL.
>What am I missing?

If you do this in the BEFORE INSERT, no blob ID is available. Blobs
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).