How can I tell if Database to exist?

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ibdac1pro
Posts: 48
Joined: Fri 25 Aug 2006 02:19

How can I tell if Database to exist?

Post by ibdac1pro » Thu 22 Jan 2015 03:56

How can I tell if Database to exist?

for example
if UniConnect1.ExistsDataBase('MyDBName') then
DB creattion..
else
DB Open...

Unidac 6.02

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

Re: How can I tell if Database to exist?

Post by AlexP » Thu 22 Jan 2015 07:30

Hello,

Please specify the name of the DB you are using.

ibdac1pro
Posts: 48
Joined: Fri 25 Aug 2006 02:19

Re: How can I tell if Database to exist?

Post by ibdac1pro » Fri 23 Jan 2015 05:55

Sqlite for Android(embedded).

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

Re: How can I tell if Database to exist?

Post by AlexP » Fri 23 Jan 2015 08:15

To implement such behavior, you should set the ForceCreateDatabase option to True. In this case, if a database doesn't exist, it will be created automatically. Otherwise, the existing database will be opened.

Code: Select all

UniConnetion.SpecificOptions.Values['ForceCreateDatabase'] := 'True';
P.S. Since SQLite is a file database, then for check it is enough to ensure file existence.

ibdac1pro
Posts: 48
Joined: Fri 25 Aug 2006 02:19

Re: How can I tell if Database to exist?

Post by ibdac1pro » Sat 24 Jan 2015 02:44

Hi,

OK. Thanks a lot.

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

Re: How can I tell if Database to exist?

Post by AlexP » Mon 26 Jan 2015 07:36

If you have any further questions, feel free to contact us.

Post Reply