Statically linking sqlite driver

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQLite in Delphi and C++Builder
rbalaji712
Posts: 9
Joined: Wed 13 May 2015 11:32

Statically linking sqlite driver

Post by rbalaji712 » Wed 13 May 2015 11:37

Hi,

Could you please confirm "Statically linking" sqlite dbexpress driver, without using sqlite3.dll, to the sqlite database as mentioned in the devart website is same as the following code "Direct Connection" mentioned in the Readme for the driver or is it different. If it is not, could you please provide a sampel code for that?

For Direct connection:

SQLConnection.ConnectionName := 'Devart SQLite Direct';
SQLConnection.DriverName := 'DevartSQLiteDirect';
SQLConnection.LibraryName := <library name>; // <library name> depends on your IDE version. See the table below.
SQLConnection.GetDriverFunc := 'getSQLDriverSQLiteDirect';
SQLConnection.Params.Clear;
SQLConnection.Params.Add('Database=MyDatabase');
SQLConnection.Open;

Thanks,
Balaji R

ZEuS
Devart Team
Posts: 240
Joined: Thu 05 Apr 2012 07:32

Re: Statically linking sqlite driver

Post by ZEuS » Thu 14 May 2015 08:54

Yes, you are right. "Static linking" and "Direct Connection" terms mean the same.

rbalaji712
Posts: 9
Joined: Wed 13 May 2015 11:32

Re: Statically linking sqlite driver

Post by rbalaji712 » Thu 14 May 2015 11:48

Thanks for the confirmation.

ZEuS
Devart Team
Posts: 240
Joined: Thu 05 Apr 2012 07:32

Re: Statically linking sqlite driver

Post by ZEuS » Thu 14 May 2015 11:53

Thank you for your interest in our products.
Feel free to contact us if you have any further questions about dbExpress driver for SQLite.

rbalaji712
Posts: 9
Joined: Wed 13 May 2015 11:32

Re: Statically linking sqlite driver

Post by rbalaji712 » Mon 18 May 2015 07:28

Hi,

When trying to use the Direct sqlite connection from DevArt sqlite driver, I observed the following.

1. 'Local time unavailable' Error: I get the mentioned error message when trying to insert a record in to a table which has a trigger that uses the datetime('now','localtime') function from sqlite. From the application I try to insert values for one integer column alone and I expect the trigger to update the datetime value for the other column in the table.
This used to work when we connected using the sqlite3.dll and dbexpsqlite40.dll previously.
I couldn't test it with latest drivers since I dont' have 64 bit sqlite3.dll. Also, when I directly insert data in to the table for the column 'a' alone from sqlite command prompt it works. Is this a bug in driver?

In the following link
http://www.devart.com/dbx/sqlite/revision_history.html

I can see some bug fix related to datetime in an older version, is this fixed, is this what I am experiencing? I am using 3.6.9 version of the drivers.

3.3.4 21-Oct-13

Rad Studio XE5 is supported
Now the Direct mode driver is based on the SQLite engine version 3.8.0.2
The 'True' Boolean value is now saved in the database as 1
Bug with retrieving indexes is fixed
Bug with an incorrect datetime (date, 'localtime') function result in the Direct mode driver is fixed
Bug with detecting auto-increment fields is fixed



CREATE TABLE TestDatetime(a integer, b datetime);
CREATE TRIGGER TestDatetime_insert after insert on TestDatetime
for each row
begin
update TestDatetime set b = datetime('now', 'localtime');
end;


2. Is it necessary to provide the dbexpsqlite40.dll path when using 'Direct Connection' or including the unit name 'DBXDevartSQlite' and specifying the dcu path for 'DBXDevArtSqlite' and other dcus sufficient ?

3. Where can I find additional information regarding the drivers and its sample code?

Thanks,
Balaji R

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Statically linking sqlite driver

Post by AlexP » Tue 19 May 2015 10:32

Hello,

1) We cannot reproduce the problem. The below sample returns correct data. Please modify it so that the problem can be reproduced and send it back to us.

Code: Select all

program Project1;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils, DbxDevartSQLite, SqlExpr;

var
  SQLConnection: TSQLConnection;
  SQLQuery: TSQLQuery;

begin
  SQLConnection := TSQLConnection.Create(nil);
  try
    SQLConnection.DriverName := 'DevartSQLiteDirect';
    SQLConnection.ConnectionName := 'Devart SQLite Direct';
    SQLConnection.Params.Values['DataBase'] := ':memory:';
    SQLConnection.LoginPrompt := False;
    SQLConnection.Connected := True;
    SQLConnection.ExecuteDirect('CREATE TABLE TestDatetime(a integer, b datetime)');
    SQLConnection.ExecuteDirect('CREATE TRIGGER TestDatetime_insert after insert on TestDatetime' + #13#10 +
                               'for each row' + #13#10 +
                               'begin' + #13#10 +
                               'update TestDatetime set b = datetime(''now'', ''localtime'');' + #13#10 +
                               'end;');
    SQLConnection.ExecuteDirect('INSERT INTO TestDatetime values(datetime(''now'', ''localtime''),0)');

    SQLQuery := TSQLQuery.Create(nil);
    try
      SQLQuery.SQLConnection := SQLConnection;
      SQLQuery.SQL.Text := 'select * from TestDatetime';
      SQLQuery.Open;
      Writeln(SQLQuery.FieldByName('b').AsString);
    finally
      SQLQuery.Free;
    end;
  finally
    SQLConnection.Free;
    Readln;
  end;
end.
2) Yes, the DBXDevartSQlite module must be added to the project, and if the path to this module is not specified in LibraryPath or SearchPath, it is also must be specified.
If the application can find the dbexpsqlite40.dll library (it can be in the System32 folder, in the folder with the application), then there is no need to specify the path to it.

3) You can find samples in the ..\Devart\Dbx\SQLite\Demos\ folder. See the driver description in the ..\Devart\Dbx\SQLite\Readme.html file.

rbalaji712
Posts: 9
Joined: Wed 13 May 2015 11:32

Re: Statically linking sqlite driver

Post by rbalaji712 » Tue 19 May 2015 11:52

Hi,

Thanks for the reply.

The error is thrown if I compile your code as 64 bit application. 32 bit works fine. I use Delphi XE7 and Windows 8.1.

Thanks,
Balaji R

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Statically linking sqlite driver

Post by AlexP » Wed 20 May 2015 08:08

We have reproduced the described case and will investigate the reason for such behavior. We will inform you as soon as we have any results.

rbalaji712
Posts: 9
Joined: Wed 13 May 2015 11:32

Re: Statically linking sqlite driver

Post by rbalaji712 » Wed 20 May 2015 11:35

Thanks. We are considering the use of direct connection to sqlite Db for an upcoming release.
Please let us know as early as you can as to whether this can be fixed.

Thanks,
Balaji R

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Statically linking sqlite driver

Post by AlexP » Fri 22 May 2015 08:37

We have already fixed the problem. The fix will be included in the next version.

rbalaji712
Posts: 9
Joined: Wed 13 May 2015 11:32

Re: Statically linking sqlite driver

Post by rbalaji712 » Fri 22 May 2015 09:55

Hi,

Could you please tell me when the next version is expected to be available? We can plan to go with current approach or use some other approach based on the timing of this fix.

Thanks,
Balaji R

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Statically linking sqlite driver

Post by AlexP » Mon 25 May 2015 09:35

Yes, we can send you the night build including the fix. Please send your license number to alexp*devart*com and specify the e-mail where we can send the build.

rbalaji712
Posts: 9
Joined: Wed 13 May 2015 11:32

Re: Statically linking sqlite driver

Post by rbalaji712 » Tue 02 Jun 2015 11:46

Hi Alex,

My colleague (Roy Randazza) and I (Balaji) had emailed ([email protected]) you for the nightly build that you said you will share. Could you please send the build to Mr Roy? If "[email protected]" is incorrect email id, pleaes let us know the correct one.

Also please let us know when you plan to release the build with this fix.

Thanks,
Balaji R

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Statically linking sqlite driver

Post by AlexP » Wed 03 Jun 2015 09:20

I haven't received any letters from you. Please resend your credentials to [email protected]

rbalaji712
Posts: 9
Joined: Wed 13 May 2015 11:32

Re: Statically linking sqlite driver

Post by rbalaji712 » Thu 04 Jun 2015 09:32

Hi Alex,

I have forwarded the email I sent you to the support email id that you menioned. My email id is [email protected]. Please check with the support team for emails from this email id.

Thanks,
Balaji R

Post Reply