mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 23:49:22 +02:00
* fcl-db: cosmetic
git-svn-id: trunk@28309 -
This commit is contained in:
parent
bf51683e78
commit
935a3f1bc9
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
This file is part of the Free Pascal Classes Library (FCL).
|
This file is part of the Free Pascal Classes Library (FCL).
|
||||||
Copyright (c) 2006 by the Free Pascal development team
|
Copyright (c) 2006-2014 by the Free Pascal development team
|
||||||
|
|
||||||
SQLite3 connection for SQLDB
|
SQLite3 connection for SQLDB
|
||||||
|
|
||||||
@ -524,6 +524,7 @@ begin
|
|||||||
Delete(S,1,P);
|
Delete(S,1,P);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// Parses string-formatted date into TDateTime value
|
||||||
Function ParseSQLiteDate(S : ShortString) : TDateTime;
|
Function ParseSQLiteDate(S : ShortString) : TDateTime;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
@ -536,6 +537,7 @@ begin
|
|||||||
Result:=EncodeDate(Year,Month,Day);
|
Result:=EncodeDate(Year,Month,Day);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// Parses string-formatted time into TDateTime value
|
||||||
Function ParseSQLiteTime(S : ShortString; Interval: boolean) : TDateTime;
|
Function ParseSQLiteTime(S : ShortString; Interval: boolean) : TDateTime;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
@ -555,6 +557,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// Parses string-formatted date/time into TDateTime value
|
||||||
Function ParseSQLiteDateTime(S : String) : TDateTime;
|
Function ParseSQLiteDateTime(S : String) : TDateTime;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -612,17 +615,17 @@ begin
|
|||||||
ftDateTime,
|
ftDateTime,
|
||||||
ftDate,
|
ftDate,
|
||||||
ftTime: if st1 = sttext then
|
ftTime: if st1 = sttext then
|
||||||
begin
|
begin { Stored as string }
|
||||||
setlength(str1,sqlite3_column_bytes(st,fnum));
|
setlength(str1,sqlite3_column_bytes(st,fnum));
|
||||||
move(sqlite3_column_text(st,fnum)^,str1[1],length(str1));
|
move(sqlite3_column_text(st,fnum)^,str1[1],length(str1));
|
||||||
case FieldDef.datatype of
|
case FieldDef.datatype of
|
||||||
ftDateTime: PDateTime(Buffer)^:=ParseSqliteDateTime(str1);
|
ftDateTime: PDateTime(Buffer)^:=ParseSqliteDateTime(str1);
|
||||||
ftDate : PDateTime(Buffer)^:=ParseSqliteDate(str1);
|
ftDate : PDateTime(Buffer)^:=ParseSqliteDate(str1);
|
||||||
ftTime : PDateTime(Buffer)^:=ParseSQLiteTime(str1,true);
|
ftTime : PDateTime(Buffer)^:=ParseSqliteTime(str1,true);
|
||||||
end; {case}
|
end; {case}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin { Assume stored as double }
|
||||||
PDateTime(buffer)^ := sqlite3_column_double(st,fnum);
|
PDateTime(buffer)^ := sqlite3_column_double(st,fnum);
|
||||||
if PDateTime(buffer)^ > 1721059.5 {Julian 01/01/0000} then
|
if PDateTime(buffer)^ > 1721059.5 {Julian 01/01/0000} then
|
||||||
PDateTime(buffer)^ := PDateTime(buffer)^ + JulianEpoch; //backward compatibility hack
|
PDateTime(buffer)^ := PDateTime(buffer)^ + JulianEpoch; //backward compatibility hack
|
||||||
|
Loading…
Reference in New Issue
Block a user