Is there a way to wrap a constant as a query? i.e...
# exposed
j
Is there a way to wrap a constant as a query? i.e.
SELECT 1
v
this is what I did:
Copy code
object One : Expression<String>() {
    override fun toQueryBuilder(queryBuilder: QueryBuilder) = queryBuilder { append("1") }
}
and use like
slice(One)
t
There is
intLiteral
and
intParam
functions for that, but you have to declare some fake table, like DUAL in Mysql.
Copy code
object DualTable : Table("DUAL") 

DualTable.slice(intLiteral(1)).selectAll()
j
@tapac it looks like the
Query
object will always append
FROM
, which I believe returns the literal value for each row. I am guessing that there is no object that adheres to
Query
that doesn't use
FROM
😬
My initial instinct was to try
wrapAsQuery { intLiteral(1) }
😄