Unidac sqlite

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
frednerk
Posts: 13
Joined: Tue 07 Feb 2012 02:50

Unidac sqlite

Post by frednerk » Thu 14 Jan 2016 23:37

Hi All,
I need to use a sqlite database with unidac.
What I would like is
1. Code example to create a database and save that to the hard drive (not just a memory one)
2. The correct sqlite3.dll touse.
I keep having crashes with the dll's I have tested.
The sqlie3.dll is placed in the exe folder.
I am using Delphi 7

Thanks in advance

Tom Duncan

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

Re: Unidac sqlite

Post by MaximG » Fri 15 Jan 2016 10:56

1. The detailed information about database creation and connection using UniDAC is provided in our documentation: https://www.devart.com/unidac/docs/?basics.htm . Use a small console application as demo sample:

Code: Select all

program Project1;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils, Uni, UniProvider, SQLiteUniProvider;

var UniConnection: TUniConnection;

begin
  UniConnection := TUniConnection.Create(Nil);
  try
    UniConnection.ProviderName := 'SQLITE';
    UniConnection.SpecificOptions.Values['Direct'] := 'True';
    UniConnection.SpecificOptions.Values['ForceCreateDataBase'] := 'True';
    UniConnection.DataBase := '< your SQLite DB Name >';
    UniConnection.Connect;
    WriteLn('DataBase created !');
    ReadLn;
  finally
    UniConnection.Free;
  end;
end.
or learn our demo sample: [ UniDAC Install folder ]\Demos\UniDacDemo\UniDacDemo.dpr

2. You can download the SQLITE3.DLL client library from the official website: http://www.sqlite.org/download.html

frednerk
Posts: 13
Joined: Tue 07 Feb 2012 02:50

Re: Unidac sqlite

Post by frednerk » Fri 15 Jan 2016 11:42

I have done another test on my demo.
I am using Windows 7 64 bit
Delphi 7
Unidac Professional. (registered)

The latest sqlite3.dll from their site x86-3100000
I have set Direct:= True;
ForceCreateDatabase:= True;
Have a SqliteUniprovider.

Here is the code which crashes Delphi.

Code: Select all

    UniConnection1.ProviderName := 'SQLITE';
    UniConnection1.Database := 'c:\tom\fred.db';

    UniConnection1.Connect;

    UniConnection1.ExecSQL('CREATE TABLE T_TEST (ID INTEGER, NAME VARCHAR(50))',[]);

    UniConnection1.ExecSQL('INSERT INTO T_TEST VALUES(1, ''Test Name'')',[]);

    UniQuery1.Connection := UniConnection1;
    UniQuery1.SQL.Text := 'SELECT * FROM T_TEST';
    UniQuery1.Open;

    ShowMessage(UniQuery1.FieldByName('ID').AsString + ' - ' + UniQuery1.FieldByName('NAME').AsString);

    UniQuery1.Append;
    UniQuery1.FieldByName('ID').AsInteger := 2;
    UniQuery1.FieldByName('NAME').AsString := 'New Name';
    UniQuery1.Post;

    ShowMessage(UniQuery1.FieldByName('ID').AsString + ' - ' + UniQuery1.FieldByName('NAME').AsString);

    UniQuery1.Close;
Any thoughts.
Have also tested earlier versions with crashes as well.

Will test the console version now.
Have done that and it worked.
So what am I doing wrong with the normal version?

Tom

frednerk
Posts: 13
Joined: Tue 07 Feb 2012 02:50

Re: Unidac sqlite

Post by frednerk » Fri 15 Jan 2016 11:57

Have tested the UniDac demo using a created sqlite file.
I used the file created with the console app.
It gave me an Access violation at address 007F.

Not a happy chap. :cry:

frednerk
Posts: 13
Joined: Tue 07 Feb 2012 02:50

Re: Unidac sqlite

Post by frednerk » Sat 16 Jan 2016 04:03

I have had success in my setting up with my local machine.
However, if I run in debug mode I get a blocking error.
If I run the exe then all is now fine.
Any thoughts on how I can reconfigure the debug mode to accept this error and work.

Thanks in advance.

Tom

sorry wrong area.
Will repost

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

Re: Unidac sqlite

Post by MaximG » Wed 20 Jan 2016 07:06

Thank you for the information. We have reproduced the issue and will investigate its origin. We will inform you about the results shortly

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

Re: Unidac sqlite

Post by MaximG » Tue 26 Jan 2016 16:21

We continue investigation of the issue in UniDAC that leads to «Access violation at address 007F» . As a workaround, try to include FastMM (Fast Memory Manager) into your project. For this:

1. Download an archive with FastMM (http://sourceforge.net/projects/fastmm/);
2. Unpack the downloaded archive;
3. Add the path to the folder containing FastMM to the Library Path list: Tools\Environment Options...\Library\Library Path
4. Add the FastMM4 module at the first place to the uses section of your project .dpr file.

Let us know the results after including FastMM into your project.

Post Reply