Page 1 of 1

Not inserting blob field on Sybase 15.7

Posted: Tue 20 Jan 2015 10:55
by paufra
Hello,

last weekend we migrated from Sybase 12.5.4 to Sybase 15.7 and we began to experience some problems with Image fields.

In Sybase 12.5.4 this Code Worked fine to load Blobs(JPG images):

Code: Select all

TImagenes.FieldByName('Orden').AsInteger := TImagenes.RecordCount + 1;
TImagenesGraph.LoadFromStream(corriente);
TImagenes.FieldByName('EnBD').AsBoolean    := false;
TImagenes.Post;
TImagenes.First;
TImagenes is a TUniTable component. corriente is a Stream with the JPG file to store.

When the execution reaches the Post is hangs with no error, even no timeout after 10 minutes. We have tried other components:
TUniQuey: Hangs when calling Execute.
TUniSQL: It does not hang, but doesn't insert the line.

Small code to replicate in XE6:

Code: Select all

// 'CREATE TABLE TempFotos ( Graph text, Orden Int, EnBD bit )'
    try
        with UniQuery1 do
        begin
            ParamByName('Orden').AsInteger := 1;
            ParamByName('Graph').LoadFromFile('C:\Users\916278\Pictures\belen.JPG', ftBlob);
            ParamByName('EnBD').AsBoolean := false;

            Execute;
        end;

        MessageDlg('Se ha insertado correctamente', mtInformation, [mbOK], 0);
    except
        on e: Exception do
        begin
            ShowMessage(e.message);
        end;
    end;
Tested in:
Delphi 6, XE6
Sybase 15.7
UniDAC 6.0.1

Do I have to activate any connection option to insert blobs on Sybase 15.7?

Thanks

Re: Not inserting blob field on Sybase 15.7

Posted: Wed 21 Jan 2015 10:57
by AlexP
Hello,

An error occurs on an attempt to execute your code: 'Operand type clash: IMAGE is incompatible with TEXT' . To insert an image, you should change the field type from text to image. In this case data will be inserted correctly.

Re: Not inserting blob field on Sybase 15.7

Posted: Wed 21 Jan 2015 11:35
by paufra
Hello,

In the original code it was of type "image" I changed to text in one of my attempts to solve the issue. Sorry about that.

Create table:
Image

Insert with UniSQL
Image

Log file:
21/01/2015 12:15:15 0.031 SQL Execute: CREATE TABLE TempFotos ( Graph image, Orden Int, EnBD bit )
grant INSERT on TempFotos to guest
Complete
...
21/01/2015 12:18:42 0.000 SQL Execute: INSERT
tempdb.guest.TempFotos
(Graph, Orden , EnBD)
VALUES (:Graph, :Orden, :EnBD)
:Graph(Memo,IN)=<BLOB:58484>
:Orden(Integer,IN)=1
:EnBD(Boolean,IN)=Falso Complete
Insert with UniQuery, App hangs:
Image

Even with the type mismatch UniDAC doesn't return any errorcode. Just hags with TUniTable and TUniQuery.

Re: Not inserting blob field on Sybase 15.7

Posted: Wed 21 Jan 2015 12:58
by AlexP
We cannot reproduce the problem, please specify the exact versions of the Sybase client.

Re: Not inserting blob field on Sybase 15.7

Posted: Wed 21 Jan 2015 16:48
by paufra
Sybase client 12.5

Code: Select all

C:\>isql -v
Sybase CTISQL Utility/12.5/P/PC Intel/BUILD125-005/OPT/Sat May 19 14:48:00 2001

Re: Not inserting blob field on Sybase 15.7

Posted: Thu 22 Jan 2015 11:14
by AlexP
Yes, the problem is indeed reproduced on this client version. We will continue investigation of the issue. Currently, to solve the problem, we recommend to update the client.