1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
| uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, System.Rtti,
FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf,
FireDAC.Phys.Intf, FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.Stan.Async,
FireDAC.Phys, FireDAC.Phys.SQLite, FireDAC.Phys.SQLiteDef,
FireDAC.Stan.ExprFuncs, FireDAC.FMXUI.Wait, FireDAC.Stan.Param, FireDAC.DatS,
FireDAC.DApt.Intf, FireDAC.DApt,
Data.Bind.EngExt, Fmx.Bind.DBEngExt,
Fmx.Bind.Grid, System.Bindings.Outputs, Fmx.Bind.Editors,
Data.Bind.Components, Data.Bind.Grid, Data.Bind.DBScope, Data.DB,
FireDAC.Comp.DataSet, FireDAC.Comp.Client, FireDAC.Comp.UI, FMX.Layouts,
FMX.Grid, FMX.StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Grid1: TGrid;
FDGUIxWaitCursor1: TFDGUIxWaitCursor;
BindSourceDB1: TBindSourceDB;
FDConnection1: TFDConnection;
FDQuery1: TFDQuery;
BindSourceDB2: TBindSourceDB;
BindingsList1: TBindingsList;
LinkGridToDataSourceBindSourceDB2: TLinkGridToDataSource;
Button2: TButton;
Button3: TButton;
procedure FormCreate(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
SQLitePhysDriverLink: TFDPhysSQLiteDriverLink;
SQLiteCollation: TFDSQLiteCollation;
procedure TForm1.FormCreate(Sender: TObject);
begin
with FDConnection1 do
if Connected then Connected := False;
{La connexion doit être fermée avant de définir la collation }
SQLitePhysDriverLink:= TFDPhysSQLiteDriverLink.Create(nil);
SQLiteCollation:= TFDSQLiteCollation.Create(nil);
With SQLiteCollation do begin
Active := False; { Ouuverte par défaut !!! Voici le problème}
{Directement récupérér du unit1.fmx :
DriverLink = FDPhysSQLiteDriverLink1
Active = True
CollationName = 'UTF16NoCase'
Flags = [sfIgnoreCase]}
{Donc}
DriverLink := SQLitePhysDriverLink;
CollationName := 'UTF16NoCase';
Flags := [sfIgnoreCase];
Active := True;
end;
{Ouverture de FDConnection après activation de SQLiteCollation }
with FDConnection1 do begin
Params.Add ('DriverID = SQLite'); {Inutile ici}
Params.Add ('OpenMode = CreateUTF8'); {Idem}
Connected := True;
end;
end; |