calculated fields always string datatype

Forum related to SQLite

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
vannus
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 26.10.2010, 21:04

calculated fields always string datatype

Post by vannus »

Hi,

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

SELECT
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
FROM
Orders, Mixes

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

- V
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Hi,

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?

Mark
Image
vannus
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 26.10.2010, 21:04

Post by vannus »

I tried SQLite mailing list first, and they suggested

SELECT
typeof(Orders.Total/100),
typeof((Orders.Total/100)*Mixes.Percentage),
typeof(count(Orders))
FROM
Orders, Mixes

which doesn't work in zeos (think it doesn't like typeof()), but in sqlite express all 3 return integer.
Randalllskymn
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 04.01.2017, 12:27
Location: Poland
Contact:

calculated fields always string datatype

Post by Randalllskymn »

Thanks but I think is not working wile the table is open.

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