Delphi 10 Seattle - Issue with SQL Server Varbinary(max)

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
WestyOz
Posts: 18
Joined: Tue 23 Jun 2015 06:18

Delphi 10 Seattle - Issue with SQL Server Varbinary(max)

Post by WestyOz » Mon 07 Mar 2016 10:03

I have a question regarding how the SQL Server type of varbinary(max) seems to be handled differently depending on the target platform.

The context of my issue is I have some images stored in my SQL Server 2014 database in a varbinary(max) field.

I connect to this database using the TMSConnection under auServer authentication. To this connection I link a TMSStoredProc component that calls a stored procedure that returns the fields of the table (select SystemImageId, SystemImage from dbo.systemImages).

When adding the fields to the TMSStoredProc the varbinary(max) column comes in as a TBlobField type.

The data is extracted from this field using techniques similar to:

BlobStream := selResourceTypesCurrentList.CreateBlobStream(selResourceTypesCurrentList.FieldByName('SystemImage'),TBlobStreamMode.bmRead);
localBitmap.LoadFromStream(BlobStream);

When I target either 32-bit or 64-bit Windows platforms this works fine and I am able to create & load from the stream into a TBitmap.

However if I target either the Android or IOS platforms I receive an exception at the 'CreateBlobStream' stating the expected type is incorrect - current : Blob; expected : VarBytes;

Is this an expected result or is there something I am missing? One alternative have looked at is using a TMSStoredProc component for the IOS/Android platforms but this doesn't seem the optimal solution - and I am having trouble being able to convert the data from the field which is a VarByte (TVarByteField) into a bitmap.

The TBlobField approach seems to be much cleaner and is the type that is automatically assigned to the field through the designer - is this a bug or is there some configuration that can help here?

WestyOz
Posts: 18
Joined: Tue 23 Jun 2015 06:18

Re: Delphi 10 Seattle - Issue with SQL Server Varbinary(max)

Post by WestyOz » Mon 07 Mar 2016 10:05

NB - The version of SDAC I am currently using is 7.2.10

thanks,
WestyOz.

Malc123
Posts: 9
Joined: Mon 04 Jul 2011 13:35

Re: Delphi 10 Seattle - Issue with SQL Server Varbinary(max)

Post by Malc123 » Tue 08 Mar 2016 08:54

I don't want to hijack this but I have a similar problem when using a Varchar(max) field. Runs on windows but Android give the error Type mismatch expecting Memo actual String

SDAC 7.2.10

azyk
Devart Team
Posts: 1057
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Delphi 10 Seattle - Issue with SQL Server Varbinary(max)

Post by azyk » Thu 10 Mar 2016 14:36

Thank you for the information. We have reproduced the mentioned issues and fixed them. These fixes will be included in the next SDAC version.

WestyOz
Posts: 18
Joined: Tue 23 Jun 2015 06:18

Re: Delphi 10 Seattle - Issue with SQL Server Varbinary(max)

Post by WestyOz » Thu 10 Mar 2016 22:45

Thank you for the feedback - appreciate your prompt attention (again!) and look forward to the next release.

Post Reply