Page 1 of 1

Reading bigints written to integer fields in sqlite

Posted: Tue 02 Sep 2014 12:57
by sandy771
My problem is related to sqlites relaxed type affinity in that if a integer field is defined as a bigint all is OK. Unfortunately sqlite allows the user to define a field as integer, but will happily store a bigint in the field without any loss. So when I try and read an integer field that contains a value > 32bits into a grid I get an erroneous value displayed.

I have no control over my source datasets, so I cannot ensure that fields are defined correctly therefore I am looking for a way with Devart to get around this.

Is there a way with unidac to force a field to return a type definition of bigint/largeint?

Ideally I would like to force all integer fields to show a defined type of bigint if this is possible.

Cheers

Re: Reading bigints written to integer fields in sqlite

Posted: Tue 02 Sep 2014 18:20
by sandy771
Think I have sorted it - Data Type Mapping in TUniConnection seems to have done the trick

Re: Reading bigints written to integer fields in sqlite

Posted: Thu 04 Sep 2014 11:58
by AlexP
Hello,

Glad to see that the issue was resolved. If you have any further questions, feel free to contact us.

Re: Reading bigints written to integer fields in sqlite

Posted: Thu 04 Sep 2014 12:18
by sandy771
Hi Alex

Did you see my longer email regarding a similar problem where the field is defined as a timestamp but the data stored within is a float but representing a mac absolute time (seconds and fractions since 1/1/2001) rather than Julian (days since November 24, 4714 B.C)

I really need to be able to read the underlying float and datatyping does not seem to work for this.

Re: Reading bigints written to integer fields in sqlite

Posted: Thu 04 Sep 2014 12:32
by AlexP
To get such date as Float, you should set the NativeDate option to False and use the AsFloat method for the field. If you want to display such float values in the grid, you can use the onGetText event of this field, retrieve the value using the AsFloat method, map it explicitly to string or to date by modifying it as required.