Query runs raw but not with Query Builder `->get()`
Hi there! I'm struggling for a while already with the following problem:
I generate this instruction with the Query Builder (code below is the result of a DB::getQueryLog()), but it doesn't retrieve the data, with no errors, only an empty array.
array:1 [
0 => array:3 [
"query" => "select `id`, `content` from `mediator_responses` where (`private` = ? or `private` = ?) and exists (select `mediator_response_situations`.`id` from `mediator_response_situations` where `mediator_response_situations`.`mediator_response_id` = ? and exists (select `id` from `forum_threads` where `mediator_response_situations`.`model_id` = ? and (`title` LIKE ? or `content` LIKE ?)))"
"bindings" => array:6 [
0 => "1"
1 => "0"
2 => "mediator_responses.id"
3 => "forum_threads.id"
4 => "%a%"
5 => "%a%"
]
"time" => 0.64
]
]
The mysterious thing is, when I copy the generated query, manually replace the bindings and run it with DB::raw(), everything works perfectly...
@Sinnbeck The query it creates is in the first code block I let (on top), which was got with DB::getQueryLog(). I think it would be the same in DebugBar's, right?
@camilo generally I would say yes, but in a case like this I would double check it. Also it might be worth seeing if mysql strict mode makes a difference. You can try turning it off in the connection
@Sinnbeck Well, thanks for the attention. But since I'm running against time here I won't be able to dig deeper. If I bump into this in the future again I let you know ;)