unit Unit2;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
Uni, UniProvider, SQLiteUniProvider, FMX.Controls.Presentation, FMX.StdCtrls;
type
TForm2 =
class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form2: TForm2;
uniconnection: TUniConnection;
uniquery: TUniQuery;
implementation
{$R *.fmx}
procedure TForm2.Button1Click(Sender: TObject);
var
dbFile:
String;
begin
uniconnection := TUniConnection.Create(
nil);
uniconnection.ProviderName := '
SQLite';
uniconnection.SpecificOptions.Values['
Direct'] := '
True';
uniconnection.SpecificOptions.Values['
EncryptionAlgorithm'] := '
leAES256';
uniconnection.SpecificOptions.Values['
EncryptionKey'] := '
TesttestTEST';
uniconnection.SpecificOptions.Values['
ForceCreateDatabase'] := '
True';
{$IFDEF MacOS}
ForceDirectories(GetHomePath + PathDelim +'
Documents' + PathDelim + '
unidacTest');
{$ENDIF}
dbFile :=
{$IFDEF MSWindows}ExtractFileDir(ParamStr(0))+'
\sqliteDb.sqlite';
{$ENDIF}
{$IFDEF MACOS}GetHomePath +PathDelim +'
Documents'+ PathDelim + '
unidacTest'+ PathDelim +'
sqliteDb.sqlite';
{$ENDIF}
uniconnection.Database := dbFile;
end;
procedure TForm2.Button2Click(Sender: TObject);
begin
uniconnection.Connect;
uniquery := TUniQuery.Create(
nil);
uniquery.Connection := uniconnection;
uniquery.SQL.Text := '
CREATE TABLE test (testId, int)';
uniquery.ExecSQL;
end;
end.