Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter 4.0 Query Builder and CAST support
#1

The Codeigniter 4 query generator allows you to use CAST to convert a value of one type to another within functions like(), where(), etc. ?

For example, now the like() function return a query like this:
Code:
SELECT *
FROM "table"
WHERE "field" LIKE '%foo%' ESCAPE '!'
ORDER BY "field" ASC
LIMIT 10

I would like to achieve this
Code:
SELECT *
FROM "table"
WHERE "field" LIKE CAST('%foo%' AS TEXT) ESCAPE '!'
ORDER BY "field" ASC
LIMIT 10

I know that alternatively I can write the query, but I would like to know if it is possible to use the query generator.

Thank you for your answer.
Codeigniter 4 - Docker Image [github] [docker hub]
Reply


Messages In This Thread
CodeIgniter 4.0 Query Builder and CAST support - by atsanna - 03-13-2020, 08:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB