Page 1 of 1

calculated fields always string datatype

Posted: 07.01.2011, 23:01
by vannus

I think ZeosLib might be returning fields with incorrect datatypes.
count(1) and cast(count(1) as integer) gives a text result?
more to the point, cast(((myfloatfield*myotherfloatfield)/100) as real) gives a text result!

For example

Orders.ID AS OrderID,
Mixes.ID AS MixID,
Mixes.Percentage AS Percentage,
/* count(1),*/
/* cast(cout(1) as integer), */
/* 1 as one,*/
/* cast(1 as integer) AS one,*/
(Orders.Total/100)*Mixes.Percentage AS SubTotal
Orders, Mixes

But I can't get them to return as integer or real datatypes.

- V

Posted: 13.01.2011, 22:00
by mdaems

I'm not sure, but I think zeoslib can only decide if the result is an integer when the column asked for is a pure table column that can be analysed by the query parser.
Isn't it a SQLite API limitation?


Posted: 13.01.2011, 22:20
by vannus
I tried SQLite mailing list first, and they suggested

Orders, Mixes

which doesn't work in zeos (think it doesn't like typeof()), but in sqlite express all 3 return integer.

calculated fields always string datatype

Posted: 04.01.2017, 15:25
by Randalllskymn
Thanks but I think is not working wile the table is open.

I even cant see that calculated fields refresh so easily....