In Ormlite, is it possible to make case-insensitive query without writing the actual SQL?
For example, if I am looking for
column name - "AccountName" and query on the column, I would like to get results for all "Finance", "fInance", "FINANCE", etc. if I do search on "finance".
I was wondering if there's a functional support for this or if I need to write a SQL for it.
Thank you!
I am answering my own question, but the following seems to work.
newDao.query(newDao.queryBuilder().where().like("nameColumn", "finance")
.prepare())
Above seems to return all "finance", "Finance", "FINANCE" or any other variations of it.
Right now (May 2011) there is no mechanism to do this with ORMLite except for writing the actual SQL and using the queryRaw()
and other raw methods.
In many databases, MySQL for example, case insensitivity looks to be the default. But this is not the case with Postgresql nor Oracle.
A quick look around at the various database implementations shows that there is not a very easy and portable way to do this. Am I wrong?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With