-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SubQueries (tables from outside of the current model) #1175
Comments
@nowackipawel What happens if you change this |
I don't think anything will change.... /**
* Get SELECT query string
*
* Compiles a SELECT query string and returns the sql.
*
* @param boolean $reset TRUE: resets QB values; FALSE: leave QB values alone
*
* @return string
*/
public function getCompiledSelect($reset = true)
{
$select = $this->compileSelect();
if ($reset === true)
{
$this->resetSelect();
}
return $select;
}
as you see there is a $this->resetSelect() call if there is no argument passed to am I wrong? :-) |
Before go to the code, my first suspect is that it is not using the same BaseBuilder instance. |
My actual code is not up to date (~ week).
protected finalQueryString -> string (108) "SELECT * FROM
→protected originalQueryString -> string (47) "SELECT * FROM
|
If you need to access another table from within a model, it's better just to use the db's
|
In one of my models I am trying to pass subquery (another table) to final query i.e.
but instead of
CI returns:
(wrong table , additional EOLs)
It looks like we should add to BaseBuilder::resetSelect() 'QBFrom` to resetRun call. I think we should do the same with reset write. Am I right?
I saw there is also $overwrite option
BaseBuilder::from($from, $overwrite = false)
but shuldn't resetSelect clear QBFrom as well?
The text was updated successfully, but these errors were encountered: