SQLite UNIDAC Question

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
joepasquariello
Posts: 38
Joined: Wed 16 May 2007 01:12

SQLite UNIDAC Question

Post by joepasquariello » Thu 07 Jan 2010 03:03

Hello,

I'm using UNIDAC for the first time. I have a licensed version of UNIDAC Pro. The installation file is unidac300d14pro.exe.

I have a TUniConnection, TUniQuery, TUniDataSource, and TDBGrid on my form. I specify the database name in the Connection object, and I can set Connected=true, but the TUniQuery does not report any tables in the database. I have found that I can put any name in the Database property and the Connected property is true even though no such database exists. Can you explain how to connect to an SQLite3 database?

Also, when I try to build the program, I get the link error below. I have searched my disk, and there is no such file. I simply ran the install program. Do I have to do anything else?

[ILINK32 Error] Unable to open file 'SQLITEUNIPROVIDER.OBJ'

Thanks,

Joe

Challenger
Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Mon 11 Jan 2010 12:59

1. UniDAC creates SQLite database automatically if you specified the name of the database that does not exist.
2. Please add the #pragma link "liteprovider105.lib" line before the #pragma link "SQLiteUniProvider" line.

joepasquariello
Posts: 38
Joined: Wed 16 May 2007 01:12

Post by joepasquariello » Mon 11 Jan 2010 16:57

1. I have an existing database named "test.db". UNIDAC seems to be able to open that database, but when I test a query that should work, UNIDAC reports that the table does not exist.

2. I added the #pragma "SQLiteUniProvider105", and now the linker reports that OBJ cannot be found.

[ILINK32 Error] Fatal: Unable to open file 'SQLITEUNIPROVIDER105.OBJ'

3. It would be very helpful if the distribution included at least one working example project for CB2010. Could you please try to make a working example?

joepasquariello
Posts: 38
Joined: Wed 16 May 2007 01:12

Post by joepasquariello » Mon 11 Jan 2010 18:38

The problem was that I was not specifying the entire path to the existing database. Even though the database is in the project folder, it seems the database must be specified with an absolute path.

"test.sql" or ".\test.sql" do not work. Only "\...path...\test.sql" will work.

Joe

joepasquariello
Posts: 38
Joined: Wed 16 May 2007 01:12

Post by joepasquariello » Mon 11 Jan 2010 18:53

I can open the database at design time, but I still have the linker error (can't find .OBJ file).

Joe

banita
Posts: 29
Joined: Fri 19 Jun 2009 14:31

Post by banita » Mon 11 Jan 2010 20:07

#pragma link "SQLiteUniProvider" is added automatically when you drop sqlite provider component.

you should add before this line: #pragma link "liteprovider105.lib"

sory for me english

joepasquariello
Posts: 38
Joined: Wed 16 May 2007 01:12

Post by joepasquariello » Mon 11 Jan 2010 20:24

Thank you. I didn't read your other response carefully.

I don't have a file named "LiteProvider105.Lib" on my system. I do have "LiteProvider140.Lib", so I added this line, and it works:

#pragma link "LiteProvider140.Lib"

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 12 Jan 2010 10:08

Use the following code to set Database:

Code: Select all

UniConnection.Database := ExtractFilePath(Application.ExeName) + 'test.sql';

joepasquariello
Posts: 38
Joined: Wed 16 May 2007 01:12

Post by joepasquariello » Wed 13 Jan 2010 00:12

Thanks. That's fine for run-time, but we still must specify the absolute path at design-time. It should at least be possible to use ".\test.sql" at design time. It would also be nice to have an option to _not_ create a database if the specified file does not exist. It's impossible to tell that something is wrong if every value is accepted in the Database field.

Joe

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 13 Jan 2010 08:31

At design-time the current directory is the directory with Delphi. So you cannot use the current directory at design-time.

We'll consider the possibility of adding an option not to create database automatically.

joepasquariello
Posts: 38
Joined: Wed 16 May 2007 01:12

Post by joepasquariello » Wed 13 Jan 2010 19:55

Thank you.

Post Reply