Page 1 of 1

SQLite: Getting "cannot convert type" error when loading image into Blob field

Posted: Wed 05 Mar 2014 07:25
by VadimShvarts
UniDAC 5.2.7
Delphi XE5 Update2
SQLiteUniProvider

I ran the following code:

Code: Select all

program Project1;

{$APPTYPE CONSOLE}

uses SysUtils, Uni, SQLiteUniProvider, DB;

var
  UniConnection: TUniConnection;
  UniQuery: TUniQuery;
  BlobField: TBlobField;
begin
  UniConnection := TUniConnection.Create(nil);
  try
    UniConnection.ProviderName := 'SQLite';
    UniConnection.SpecificOptions.Values['SQLite.Direct'] := 'True';
    UniConnection.Database := ':memory:';
    UniConnection.Connect;
    UniConnection.ExecSQL('create table test (id integer, pic blob)');
    UniConnection.ExecSQL('Insert into test(id) values (1)');

    UniQuery := TUniQuery.Create(nil);
    try
      UniQuery.Connection := UniConnection;
      UniQuery.SQL.Text := 'Select * from test';
      UniQuery.Open;
      UniQuery.Edit;
      BlobField := UniQuery.FieldByName('Pic') as TBlobField;
      BlobField.LoadFromFile('d:\test.bmp');
      UniQuery.Post;
    finally
      UniQuery.Free;
    end;
  finally
    UniConnection.Free;
  end;
end.
I got the error "CANNOT CONVERT TYPE"

Error stack:
LiteClassesUni.BindBlob
...
UniQuery.Post

Same issue in LiteDAC was solved 26 Dec 2013

http://forums.devart.com/viewtopic.php?f=48&t=28564

Re: SQLite: Getting "cannot convert type" error when loading image into Blob field

Posted: Wed 05 Mar 2014 12:21
by AlexP
hello,

This problem is fixed in the LiteClasses module. LiteClassesUni is a module similar to LiteClasses, therefore this fix was added to both LiteDAC and UniDAC. Please make sure there are no modules from the old UniDAC version.

Re: SQLite: Getting "cannot convert type" error when loading image into Blob field

Posted: Wed 05 Mar 2014 12:30
by VadimShvarts
AlexP wrote:hello,

This problem is fixed in the LiteClasses module. LiteClassesUni is a module similar to LiteClasses, therefore this fix was added to both LiteDAC and UniDAC. Please make sure there are no modules from the old UniDAC version.
LiteClassesUni have this error in last UNIDAC version 5.2.7

Re: SQLite: Getting "cannot convert type" error when loading image into Blob field

Posted: Thu 06 Mar 2014 10:25
by AlexP
Sorry, this fix wasn't added to the current version. It will be available in the next build.

Re: SQLite: Getting "cannot convert type" error when loading image into Blob field

Posted: Tue 18 Mar 2014 04:07
by wangxiya
Please solve the problem, and release new version as soon as possible!

Re: SQLite: Getting "cannot convert type" error when loading image into Blob field

Posted: Fri 21 Mar 2014 14:10
by AlexP
We plan to release UniDAC within a month.