Einzelnen Beitrag anzeigen

Darlo

Registriert seit: 28. Jul 2008
Ort: München
1.196 Beiträge
 
Delphi 10.2 Tokyo Enterprise
 
#2

AW: [Mac OS X]UniDac 6.1.6 Encryption führt zu Runtime-Error 231

  Alt 30. Jul 2015, 15:23
und hier noch ein bisschen Code:
Delphi-Quellcode:
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.
Philip
  Mit Zitat antworten Zitat