[yunqa.de] Rounding of REAL and DISQLite3Api.DateTimeToJulianDate

  • From: Edwin Yip <edwin.yip@xxxxxxxxxxxxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Wed, 25 Feb 2009 18:57:37 +0800

Hi Ralf,
Here I have a problem regarding the value of a field of type REAL stored in
database and the value that is converted by
the DISQLite3Api.DateTimeToJulianDate function.

**************
 Table schema:
CREATE TABLE [Email] (
  [EmailDate] REAL NOT NULL
);

**************
Let's say we have a TDateTime value aDate = 39869.767373, after
calling DISQLite3Api.DateTimeToJulianDate(aDate), it's value becomes
2454888.2674

**************
insert SQL used to inert the tdatetime value into the table:

 replace into Email(EmailDate) values (?)

binding of the insert sql
 FStmtSaveMessage.Bind_Double(iEmailDate,
DISQLite3Api.DateTimeToJulianDate(aDate));

After aDate inserted inserted the value = 2454888.26736111

**************
SQL used to select the table:
select *  from Email where (EmailDate = ?)

binding:
    FStmtEmailExists.Bind_Double(1,
DISQLite3Api.DateTimeToJulianDate(aDate));

The problem is that  the above select statement does not return any records,
I think this is because of the difference after rounding (calling
of DateTimeToJulianDate), but I HAVE use this datetime value to match the
records, it's of the the combined primary keys. Any suggestion to solve my
problem? Thank you.




Best Regards,
Edwin Yip

Mind Mapping is as Effortless as Typing
http://www.InnovationGear.com

Other related posts: