#1 2015-07-28 12:34:32

alexdmatveev
Member
Registered: 2014-09-12
Posts: 87

convert TSQLRawBlob (TByteDynArray) to String

Please help me with the casting from the subject.
I am sure I have in the blob base64 encoded String.

Please keep in mind I use crossplatform library.
And please I need 2 conversions: for {$ifdef ISDWS} and {$ELSE}.

Thanks a lot.

Offline

#2 2015-07-28 13:23:00

alexdmatveev
Member
Registered: 2014-09-12
Posts: 87

Re: convert TSQLRawBlob (TByteDynArray) to String

for windows version it works so:

class function TRawBlobHelper.AsString(blob: TSQLRawBlob): RawUTF8;
var
  bytes: TByteDynArray;
begin
{$ifdef ISDWS}
{$else}
  bytes := TByteDynArray(blob);
{$endif}
  Result := TEncoding.ANSI.GetString(TBytes(bytes));
end;

Last edited by alexdmatveev (2015-07-28 13:23:26)

Offline

Board footer

Powered by FluxBB