I'm building an application that includes a BLOB SUB_TYPE 1 (Memo) field to 
store free text.  The Memo field will typically store 4800 characters, and 
several users may make changes to the 4800 characters.  I want to keep a log of 
ONLY the CHANGES made to the 4800 characters.  I don't want to keep full copies 
of the OLD. and NEW. versions of the entire 4800 character field each time a 
change is made, because that's a big waste of storage space, and it's difficult 
for a human to read through both copies to see the differences.

It would be very cool if Firebird had a CHARACTERDIFF() function that would 
take the following parameters:

CHARACTERDIFF
  (
  ORIGINAL BLOB SUB_TYPE 1,           (Example: OLD.FIELDNAME)
  CHANGED BLOB SUB_TYPE 1             (Example: NEW.FIELDNAME)
  INCLUDE_POSITION_INFO CHAR(1)       (Example: Y or N)
  )
RETURNS
  (
  BLOB SUB_TYPE 1
  );

The output would be formatted like:

(If Position info = 'N')

Added:  "however there", "cannot undergo", "2012-Sep-21"
Changed: "Sumday"/"Sunday", "unadle"/"unable"
Deleted:  "a-hole"

(If Position info = 'Y')

Added:  28 "however there", 512 "cannot undergo", 4032 "2012-Sep-21"
Changed: 16 "Sumday"/"Sunday", 4710 "unadle"/"unable"
Deleted:  2371 "a-hole"
-------------------------------------

Combined with the CURRENT_USER, I could make a nice neat little log, that would 
be easy to read and use storage efficiently.

Does Firebird have something like this?  If not, does anyone have a Stored 
Procedure that can do this?

Thanks in advance.


Reply via email to