Picture of mitop
Registered 3 years 291 days
mitop Tuesday, 12 July 2022, 10:10 AM
JS SDK database type BIGINT
Hi all,

what i want to do is to store the datetime as timestamp inside the db, like mentioned here in this post: https://forum.innovaphone.com/moodle2/mod/forum/discuss.php?d=26807

My problem is that i cannot read out the value correctly to use it on js side, inside the config.json file we have a column "BIGINT DEFAULT EXTRACT(EPOCH FROM now()) * 1000" and a second time value column "BIGINT NOT NULL". Both are written correctly (second value written from source code). But "Select *" on that table, returns only negative values. Looks like the JS part handles the BIGINT value from DB as a "integer" value (https://www.postgresql.org/docs/9.1/datatype-numeric.html). Values bigger than "2147483647" are not converted correctly, so i could store seconds until 1/19/2038, 4:14:07 AM.
Both time values in config.json were first "BIGSERAL", and set later to BIGINT. I tried to delete the corresponding table, same behaviour. (Trying to delete the Database from pgadmin it tells me that there are open sessions to my apps database and deleting the db is canceled. Have canceled this attempt for now.)


Has anyone had similar experiences? What am i doing wrong?

Best regards
Mladen


Picture of Matthias Schertler (innovaphone)
Moderator Registered 12 years 135 days
Matthias Schertler (innovaphone) Tuesday, 12 July 2022, 11:21 AM
1 of 1 users consider this post helpful
Re: JS SDK database type BIGINT
Hi Mladen,

you are right, values bigger than "2147483647" were not converted correctly.

I did a fix for that next service release:
#127570 - JS SDK: Database: Support for double values in SQL results

BR
Matthias
Picture of mitop
Registered 3 years 291 days
mitop Tuesday, 12 July 2022, 11:27 AM
Re: JS SDK database type BIGINT
Hi Matthias,

great to hear, thank you. For now i can use the timestamp in seconds and work with that smile

Best regards
Mladen
← You can define your color theme preference here