UpdateBlob not working on proxy tables

Symptom

When executing an UpdateBlob on a proxy table, no data is written in the database.

Environment

PowerBuilder Database ASE 15.0

Reproducing the Issue

1. Connect PowerBuilder to an ASE database DB1

2. On a second database DB2, create a table blobtable with columns

(id numeric(18,0) identity, description varchar(128) not null, xblob text null)  

3. Create a link from DB1 to DB2

4. From PowerBuilder, insert in blobtable a new row ( 1, "First Row")

5. Now put a blob in column xblob using:

UPDATEBLOB blobtable SET xblob = :lb WHERE id = 1;
    commit;
    MessageBox ("UpdateBlob returns :", Sqlca.SqlErrText)

The error "NULL textptr passed to WRITETEXT function." is displayed.

Cause

This problem is due to the fact that the blob column is null after inserting a new row. If the column is not null, UpdateBlob works fine with a proxy table.

Solution

Before updating the blob column, initialize the blob column with an empty string:

    
UPDATE blobtable SET xblob = '' WHERE id = :ll_id ;
    commit;