Page 1 of 1

Create SQLite Database Programatically - Example?

Posted: Tue 24 Jul 2012 11:19
by DespatchSystems
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.

Re: Create SQLite Database Programatically - Example?

Posted: Tue 24 Jul 2012 12:45
by AlexP
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.