Create SQLite Database Programatically - Example?

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQLite in Delphi and C++Builder
Post Reply
DespatchSystems
Posts: 14
Joined: Tue 24 Jul 2012 10:45

Create SQLite Database Programatically - Example?

Post by DespatchSystems » Tue 24 Jul 2012 11:19

Hi

Do you have any examples or demo's of creating a new SQLite database programatically through a Delphi application?

I can see how to create tables through code from the BlobPictures demo using:

SQLConnection.ExecuteDirect(
'CREATE TABLE DbxSQLite_BLOB (' +
' id INTEGER PRIMARY KEY,' +
' Name VARCHAR(50),' +
' Picture BLOB' +
')');

But if the SQLite database doesn't exist yet, can one be created through a Delphi XE2 program?

Any help appreciated.

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

Re: Create SQLite Database Programatically - Example?

Post by AlexP » Tue 24 Jul 2012 12:45

hello,

SQLite - is a file DB, therefore "Database" means a file on a disk. If you specify in the Database property of SQLConnection the path and name of a new non-existent file, the DB file will be created in the specified path and with the specified name automatically.

Post Reply