Subject | Re: add timestamp to text BLOB |
---|---|
Author | Rick Roen |
Post date | 2006-10-25T12:26:01Z |
Thanks Helen,
I'll avoid the "unhappy life" senario and not attempt to change the
BLOB in an SP.
I considered the extra fields for timestamp and varchar for user,
but anyone can update this note BLOB and I want some automatic way
of "stamping" the message.
I think I will write it in from the Delphi program where it checks
for a modified variable on the BLOB control and adds the extra info
there.
Rick
I'll avoid the "unhappy life" senario and not attempt to change the
BLOB in an SP.
I considered the extra fields for timestamp and varchar for user,
but anyone can update this note BLOB and I want some automatic way
of "stamping" the message.
I think I will write it in from the Delphi program where it checks
for a modified variable on the BLOB control and adds the extra info
there.
Rick
> A blob - even a text blob - isn't a string. You can't edit a blobat
> all: "editing" a blob always means "replacing an existing blobwith
> a new blob".to
>
> Your null logic for the UPDATING test is going to come to grief if
> you have OLD.NOTE null and NEW.NOTE not null or vice versa.
>
> When dealing with your string variable, the whole thing is going
> fall apart if your substring returns the whole 8190 bytes to theadd
> string variable, since appending the username and timestamp will
> ~ 60 bytes and overflow the variable. Doing what you want to dowill
> also add other problems like truncating the blob and/or reaching asize)
> point where an ever-increasing number of user/timestamp appendages
> will eventually cause shorter strings to overflow.
>
> If you still want to persevere with this idea, you could try a UDF
> such as Str2Blob in fbudf (making sure that you have defined the
> function to your database to take an input string of adequate
> and declare a local TEXT blob variable into which to feed theamended
> string, finally assigning this blob to NEW.NOTE. There areserious
> gotchas with this if you allow the application to update therecord
> more than once in the same transaction (or allow both insert andvarchar
> update of the record without enforcing a commit between the ops).
>
> OTOH, plan a happy life and consider adding a timestamp and a
> column to the table for last update date and updater,respectively,
> and don't try to tinker with NOTE at all. Users will be a lotby
> happier to know that their creation is not going to be blown away
> some invisible malevolent hand....
>
> ./heLen
>