Weird reading blob on sqlite connection

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
SooYoung
Posts: 1
Joined: Wed 22 Mar 2017 00:01

Weird reading blob on sqlite connection

Post by SooYoung » Wed 22 Mar 2017 00:30

I've use Delphi XE3 (update 2) && UNI DAC 6.2(yesterday update - 6.4.16)

My code works good for 2 years but I got some problem on reading blob from sqlite file.
It works good for before sqlilte file as usual.

unidac options which I change are "Direct - True", "UseUnicode-True"
sqlite file has some korean character then I set UseUnicode is true

sqlite file version is 3.11.0 ("select sqlite_version();")
sqlite db tool is "db browser for sqlite 3.9.1" and it shows that the blob filed's length is 1081 bytes.
my old sqlite file has same row and it's length is 1081 bytes too.

my code work good on old sqlite file. it reads 1081 bytes correct.
but my code don't work on new sqlite file. it reads only 624 bytes.

original data bytes are below.
30 33 38 30 41 44 41 44 FE 06 D6 AE 61 A0 90 BF

but delphi xe3 watch on debugging show below.
30 00 33 00 38 00 30 00 41 00 44 00 41 00 41 00 FD FF 06 00 AE 05

why this occur?

my code parts is below. Move data from Sqlite file to Oracle.

Code: Select all

function TMBPConvForm.MakeFMUTable_FRM : boolean;
var
  Buffer: TValueBuffer;
begin
  try
    qrFuelMap.SQL.Text := 'select ID, FRMAP, ENCRYPTIONDATA from FRMap order by ID ';
    qrFuelMap.Open;

    conUbiKhan.StartTransaction;
    try
      qrUbiKhan.SQL.Text := 'insert into UBIKHANS.TBL_ECO_FMUFRM (FRMCODE, FRMDATA) values ( :FRMCODE, :FRMDATA)';
      qrFuelMap.First;
      while not qrFuelMap.Eof do
      begin
        if Length(qrFuelMap.Fields[1].AsString) <= 8 then
        begin
          qrUbiKhan.ParamByName('FRMCODE').AsString := qrFuelMap.Fields[1].AsString;
          qrUbiKhan.ParamByName('FRMDATA').AsBlob   := qrFuelMap.Fields[2].AsBytes;
          qrUbiKhan.ExecSQL;
        end;
        qrFuelMap.Next;
      end;
      conUbiKhan.Commit;
      Result := true;
    except
      on E: Exception do
      begin
        conUbiKhan.Rollback;
        ShowMessage('FMU의 FRMDATA 데이터 생성에 실패했습니다. 다시 시도해보십시오.' + #13#10 + E.Message);
        Result := false;
      end;
  end;
  finally
    qrFuelMap.Close;
  end;
end;
...

I tried to another sqlite driver to solve this problem.
I set the option.
Direct -- false
ClientLibrary -- directory & file name which download from https://www.sqlite.org/download.html

Delphi XE3 show error can't find sqlite3.dll.

I wanna solve this issue.

if you want that database file or source I can offer.

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Weird reading blob on sqlite connection

Post by MaximG » Wed 24 May 2017 13:40

Please send us DB file containing the described table for investigation.
This information can be sent to us using the e-support form (https://www.devart.com - menu «Support»\«Request Support» )

Post Reply