Create SQLite Database Programatically - Example?

Create SQLite Database Programatically - Example?

Postby 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.
DespatchSystems
 
Posts: 14
Joined: Tue 24 Jul 2012 10:45

Re: Create SQLite Database Programatically - Example?

Postby 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.
AlexP
Devart Team
 
Posts: 5528
Joined: Tue 10 Aug 2010 11:35


Return to dbExpress driver for SQLite