[fpc-pascal] Cannot write datetime field on sqlite3 database on ARM

Toru Takubo takubo at e-parcel.co.jp
Tue Mar 9 09:49:31 CET 2021


On 2021/03/09 17:07, Michael Van Canneyt via fpc-pascal wrote:
> 
> 
> On Tue, 9 Mar 2021, Toru Takubo via fpc-pascal wrote:
> 
>>> I don't know what to advise to further investigate the issue, One thing to
>>> try would be to test whether normal float arithmetic or date arithmetic works.
>>> If not, then the compiler people will need to give more advice.
>>>
>>
>> I created a simple test code, and ran on linux-i386 and linux-arm.
>> Test on linux-i386 is OK but on linux-arm, I got unexpected values
>> "30-12-99" as datetime and "2.12199579096527E-314" as float, which are different
>> from values previously set. (except INT and VARCHAR fields)
>>
>> ---linux-i386--------------------------------------------
>> INT, VARCHAR,           DATETIME,           DOUBLE
>> 0, 9-3-21 08:50:23, 9-3-21 08:50:23, 0
>> 1, 9-3-21 12:16:06, 9-3-21 12:16:06, 0.142857142857143
>> 2, 9-3-21 15:41:49, 9-3-21 15:41:49, 0.285714285714286
>> 3, 9-3-21 19:07:32, 9-3-21 19:07:32, 0.428571428571429
>> 4, 9-3-21 22:33:15, 9-3-21 22:33:15, 0.571428571428571
>> 5, 10-3-21 01:58:58, 10-3-21 01:58:58, 0.714285714285714
>> 6, 10-3-21 05:24:40, 10-3-21 05:24:40, 0.857142857142857
>> 7, 10-3-21 08:50:23, 10-3-21 08:50:23, 1
>> 8, 10-3-21 12:16:06, 10-3-21 12:16:06, 1.14285714285714
>> 9, 10-3-21 15:41:49, 10-3-21 15:41:49, 1.28571428571429
>>
>> ---linux-arm---------------------------------------------
>> INT, VARCHAR,           DATETIME,           DOUBLE
>> 0, 9-3-21 08:55:53, 30-12-99, 2.12199579096527E-314
>> 1, 9-3-21 12:21:36, 30-12-99, 2.12199579096527E-314
>> 2, 9-3-21 15:47:18, 30-12-99, 2.12199579096527E-314
>> 3, 9-3-21 19:13:01, 30-12-99, 2.12199579096527E-314
>> 4, 9-3-21 22:38:44, 30-12-99, 2.12199579096527E-314
>> 5, 10-3-21 02:04:27, 30-12-99, 2.12199579096527E-314
>> 6, 10-3-21 05:30:10, 30-12-99, 2.12199579096527E-314
>> 7, 10-3-21 08:55:53, 30-12-99, 2.12199579096527E-314
>> 8, 10-3-21 12:21:36, 30-12-99, 2.12199579096527E-314
>> 9, 10-3-21 15:47:19, 30-12-99, 2.12199579096527E-314
> 
> thank you for the test program. I tested on linux 64-bit, that works OK too.
> 
> When you look in the database on the arm machine  with an sqlite tool, do
> you see the correct values or are the inserted values wrong ?
> 
> (I'm trying to establish whether the problem happens during read  or write)
> 
Looking into the database with "DB Browser for SQLite", those fields are all "0".
If you set some value in those fields by the tool, you can read them with fpc program.
Therefore problem happens on writing values, I believe.

>>
>> I used a shared library libsqlite3.so included in the "DB Browser for SQLite",
>> so it should work. What can cause such a problem only in the specific field
>> on the specific platform?
> 
> Seems like either a floating point issue, or an alignment issue.
> I know ARM has some specific behaviour with regard to alignment.
> 
> Unfortunately, I have no idea what to test or the means to test it.
> Someone more familiar with ARM will need ro test.
> 
It would be better for me to create a bug report?

Toru



More information about the fpc-pascal mailing list