CAST clause in ORMLite for Android

I used ORMLite for Android in my application. How can I make such a query?

     SELECT * FROM tableName WHERE CAST(ColumnName AS INTEGER) <= 100; 

I tried this, but it isn't work:

     where.le(ColumnName, 100);

Upvotes: 0

Views: 500

Answers (2)

Gray
Gray

Reputation: 116878

As @CL mentioned, ORMLite does not support CAST. As s/he mentions, a raw query would work well. An alternative would be to use the where.rawStatement(...) method as well which allows you to specify directly a part of there WHERE clause as a string:

where.rawStatement("CAST(ColumnName AS INTEGER) <= 100");

Upvotes: 3

CL.
CL.

Reputation: 180060

ORMLite does not have a specific wrapper for CAST.

You have to issue a raw query.

Upvotes: 2

Related Questions