https://kotlinlang.org logo
#squarelibraries
Title
# squarelibraries
m

myanmarking

09/10/2021, 3:05 PM
is there any way to perform a query that returns 1 or 0, but parse it as boolean in the generated model ?
b

Benoit Quenaudon

09/10/2021, 4:31 PM
define the field as "INTEGER AS BOOL" and all the query will use booleans
m

myanmarking

09/11/2021, 8:25 AM
i’m not talking about table definition, that it works. I’m talking about the result of a query, not directly associated with the boolean column. And that result is an int, but i want to parses to think it as a boolean. The real question probably, you cannot use ‘AS BOOL’ in queries can you ?
SELECT 1 AS BOOL (thats what i was asking). Because i know if you do ‘SELECT boolColumns FROM xxxx’ it works
a

Alex Nabrozidis

09/14/2021, 9:50 AM
does it work if you do
SELECT integerColumn = 1 FROM ...
?
I've used
COUNT(*) > 0
in the past and it worked as expected (returns a boolean)
m

myanmarking

09/14/2021, 9:53 AM
good point. I’ll check later. Thanks!
❤️ 1
3 Views