Code: Select all
Created DATETIME NULL
I tried to change SpecificOptions: NativeDate to false and the other time Specificoptions DateFormat and TimeFormat (to ISO) with no progress.
Is there any help?
Code: Select all
Created DATETIME NULL
Code: Select all
create table test(a integer, b text, c datetime)
Code: Select all
procedure TForm1.Button2Click(Sender: TObject);
var
ADate: TDateTime;
begin
ADate := EncodeDate(2018, 4, 1);
UniQuery1.Locate('a;b;c', VarArrayOf([2, 'def', ADate]), []);
end;
Code: Select all
program Project1;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
System.Variants,
DateUtils,
Data.DB,
DBAccess,
Uni,
UniProvider,
SQLiteUniProvider;
var
UniConnection: TUniConnection;
UniQuery: TUniQuery;
begin
UniConnection := TUniConnection.Create(nil);
try
UniConnection.ProviderName := 'SQLite';
UniConnection.Database := ':memory:';
UniConnection.SpecificOptions.Values['Direct'] := 'True';
UniConnection.SpecificOptions.Values['DateFormat'] := 'dd.mm.YYYY';
UniConnection.SpecificOptions.Values['TimeFormat'] := 'HH:MM:SS';
UniConnection.Connect;
UniConnection.ExecSQL('CREATE TABLE DT (UnitID INTEGER, Author TEXT, Created DATETIME, PRIMARY KEY (UnitID, Author, Created));');
UniQuery := TUniQuery.Create(nil);
try
UniQuery.Connection := UniConnection;
UniQuery.SQL.Text := 'Select * From DT ORDER BY UnitID';
UniQuery.Open;
UniQuery.Insert;
UniQuery.FieldByName('UnitID').AsInteger := 1;
UniQuery.FieldByName('Author').AsString := 'Value 01';
UniQuery.FieldByName('Created').AsDateTime := EncodeDateTime(1976, 3, 11, 21, 21, 23, 0);
UniQuery.Post;
UniQuery.Insert;
UniQuery.FieldByName('UnitID').AsInteger := 2;
UniQuery.FieldByName('Author').AsString := 'Value 02';
UniQuery.FieldByName('Created').AsDateTime := EncodeDateTime(2018, 4, 6, 13, 30, 22, 0);
UniQuery.Post;
UniQuery.Insert;
UniQuery.FieldByName('UnitID').AsInteger := 3;
UniQuery.FieldByName('Author').AsString := 'Value 03';
UniQuery.FieldByName('Created').AsDateTime := EncodeDateTime(2000, 1, 1, 12, 00, 01, 0);
UniQuery.Post;
UniQuery.Close;
UniQuery.Open;
UniQuery.Locate('UnitID;Author;Created', VarArrayOf([2, 'Value 02', EncodeDateTime(2018, 4, 6, 13, 30, 22, 0)]), []);
WriteLn(UniQuery.FieldByName('UnitID').AsString);
ReadLn;
UniQuery.Close;
finally
UniQuery.Free;
end;
UniConnection.Disconnect;
finally
UniConnection.Free;
end;
end.