You are not logged in.
Pages: 1
Compile and execute the following program.
e:\delphi12\bin\dcc32 dbtest.pas -ID:\Borland\mORMot2\src;D:\Borland\mORMot2\static\i386-win32 -Ud:\Borland\mORMot2\src\core;d:\Borland\mORMot2\src\crypt;d:\Borland\mORMot2\src\db;d:\Borland\mORMot2\src\net;D:\Borland\mORMot2\src\lib -NSSystem;Winapi
{
create table if not exists testtbl (
id int4,
start time not null default '08:30:00',
stop time not null default '14:30:00');
insert into testtbl (id, start, stop) values (1, '08:30:00', '14:30:00');
}
program dbtest;
{$ifdef FPC}
{$mode delphi}
{$else}
{$APPTYPE CONSOLE}
{$endif}
{$I mormot.defines.inc}
uses
{$I mormot.uses.inc}
{$IFDEF DCC}System.{$ENDIF}Classes, {$IFDEF DCC}System.{$ENDIF}SysUtils,
Variants,
mormot.db.sql.postgres;
var
DBProps: TSQLDBPostgresConnectionProperties;
R: variant;
startstr, stopstr: String;
start, stop: TTime;
begin
DBProps := TSQLDBPostgresConnectionProperties.Create(
'localhost', 'testdb', 'root', '12345678');
try
DBProps.ThreadSafeConnection.Connect;
with DBProps.Execute('select * from testtbl limit 1',[],@R) do
begin
while Step do begin
startstr := ColumnUTF8('start');
stopstr := ColumnUTF8('stop');
WriteLn('1: ', startstr, '-', stopstr);
start := ColumnDateTime('start');
stop := ColumnDateTime('stop');
WriteLn(Format('2: %f, %f', [start, stop]));
WriteLn('3: ', VarToStr(R.start), '-', VarToStr(R.stop));
break;
end;
ReleaseRows;
end;
except
end;
DBProps.Free;
end.
The results are as follows.
# dbtest
1: 08:30:00-14:30:00 <-- ok
2: 0.00, 0.00 <-- error
3: 0:00:00-0:00:00 <-- error
Offline
Thank you for your reply.
Is there any solution for R.start and R.stop.
Offline
Please try with
https://github.com/synopse/mORMot2/commit/6a4b2d320
Offline
Great! Everything has been solved. There's no problem with either FPC or Delphi
The results are as follows.
# dbtest
1: 08:30:00-14:30:00 <-- ok
2: 0.35, 0.60 <-- ok
3: 8:30:00-14:30:00 <-- ok
Offline
Pages: 1