You are not logged in.
Pages: 1
I am trying to create an empty Sqlite3 database by using TSQLDBSQLite3ConnectionProperties. Not errors are thrown and no database is created.
How should I do this?
procedure TForm3.FormCreate(Sender: TObject);
Var
aServerName: RawUTF8;
aDatabaseName: RawUTF8;
aUserID: RawUTF8;
aPassWord: RawUTF8;
begin
aServerName:=DirDB+'Sqlite3201211051120.db3';
aDatabaseName:='';
aUserID:='';
aPassWord:='';
DB:=TSQLDBSQLite3ConnectionProperties.Create(aServerName,aDatabaseName,aUserID,aPassWord);
end;
Thank you.
Richard Maley
Offline
There is no need to create the file explicitely.
The SQLite3 engine will create the file if not existing.
But you have to run at least one SQL statement on it.
This is the default behavior of SQLite3.
Offline
Modifying my original code as follows does create the empty table.
procedure TForm3.FormCreate(Sender: TObject);
Var
aServerName: RawUTF8;
aDatabaseName: RawUTF8;
aUserID: RawUTF8;
aPassWord: RawUTF8;
Conn: TSQLDBSQLite3Connection;
begin
aServerName:=DirDB+'Sqlite3201211051120.db3';
ShowMessage(aServerName);
aDatabaseName:='';
aUserID:='';
aPassWord:='';
DB:=TSQLDBSQLite3ConnectionProperties.Create(aServerName,aDatabaseName,aUserID,aPassWord);
DB.UseMormotCollations := False;
Conn := DB.MainConnection as TSQLDBSQLite3Connection;
Conn.Connect;
end;
Thank you for your reply.
Richard Maley
Offline
Pages: 1