Welcome Guest, Not a member yet? Register   Sign In
Generated SQL query in 4
#1

Hi all,

very new to CI and after a short time in v3 I started to getting familiar with v4 . I have some ready sql queries
(from phpmyadmin) that I would like to put into  a model . I have trouble when I have sub-queries
and I wonder if there is a way to view the generated query before it executes ?
Reply
#2

(06-27-2020, 03:17 AM)stepgr Wrote: Hi all,

very new to CI and after a short time in v3 I started to getting familiar with v4 . I have some ready sql queries
(from phpmyadmin) that I would like to put into  a model . I have trouble when I have sub-queries
and I wonder if there is a way to view the generated query before it executes ?

The builder class has four methods to get the generated query - one each for select, insert, update, and delete. Here are the signatures for them. They all return a string.

getCompiledSelect([$reset = TRUE])
getCompiledInsert([$reset = TRUE])
getCompiledUpdate([$reset = TRUE])
getCompiledDelete([$reset = TRUE])

As you've probably realized, $reset is a bool used to indicate whether to reset the current QB values or not.
Reply
#3

Thanks , very helpful .
Reply




Theme © iAndrew 2016 - Forum software by © MyBB