@@ -26,7 +26,7 @@ public function compileOptions(array $options): string
26
26
if (! empty ($ optionString )) {
27
27
$ optionString .= ', ' ;
28
28
}
29
- $ optionString .= $ key. '= ' . $ value ;
29
+ $ optionString .= $ key . '= ' . $ value ;
30
30
}
31
31
32
32
return "OPTION ( {$ optionString }) " ;
@@ -124,21 +124,23 @@ public function prepareBindingsForUpdate(array $bindings, array $values)
124
124
125
125
protected function whereNull (Builder $ query , $ where )
126
126
{
127
- if ($ this ->isJsonSelector ($ where ['column ' ])) {
127
+ $ columnValue = (string ) $ this ->getValue ($ where ['column ' ]);
128
+ if ($ this ->isJsonSelector ($ columnValue )) {
128
129
[$ field , $ path ] = $ this ->wrapJsonFieldAndPath ($ where ['column ' ]);
129
130
130
- return '(JSON_EXTRACT_JSON( ' . $ field. $ path. ') IS NULL OR JSON_GET_TYPE(JSON_EXTRACT_JSON( ' . $ field. $ path. ')) = \'NULL \') ' ;
131
+ return '(JSON_EXTRACT_JSON( ' . $ field . $ path . ') IS NULL OR JSON_GET_TYPE(JSON_EXTRACT_JSON( ' . $ field . $ path . ')) = \'NULL \') ' ;
131
132
}
132
133
133
134
return parent ::whereNull ($ query , $ where );
134
135
}
135
136
136
137
protected function whereNotNull (Builder $ query , $ where )
137
138
{
138
- if ($ this ->isJsonSelector ($ where ['column ' ])) {
139
+ $ columnValue = (string ) $ this ->getValue ($ where ['column ' ]);
140
+ if ($ this ->isJsonSelector ($ columnValue )) {
139
141
[$ field , $ path ] = $ this ->wrapJsonFieldAndPath ($ where ['column ' ]);
140
142
141
- return '(JSON_EXTRACT_JSON( ' . $ field. $ path. ') IS NOT NULL AND JSON_GET_TYPE(JSON_EXTRACT_JSON( ' . $ field. $ path. ')) != \'NULL \') ' ;
143
+ return '(JSON_EXTRACT_JSON( ' . $ field . $ path . ') IS NOT NULL AND JSON_GET_TYPE(JSON_EXTRACT_JSON( ' . $ field . $ path . ')) != \'NULL \') ' ;
142
144
}
143
145
144
146
return parent ::whereNotNull ($ query , $ where );
@@ -190,7 +192,7 @@ protected function wrapJsonFieldAndPath($column)
190
192
return "' $ part' " ;
191
193
}, $ parts );
192
194
193
- $ path = count ($ parts ) ? ', ' . implode (', ' , $ parts ) : '' ;
195
+ $ path = count ($ parts ) ? ', ' . implode (', ' , $ parts ) : '' ;
194
196
195
197
return [$ field , $ path ];
196
198
}
@@ -203,7 +205,7 @@ protected function wrapJsonFieldAndPath($column)
203
205
*/
204
206
protected function wrapUnion ($ sql )
205
207
{
206
- return 'SELECT * FROM ( ' . $ sql. ') ' ;
208
+ return 'SELECT * FROM ( ' . $ sql . ') ' ;
207
209
}
208
210
209
211
/**
@@ -231,7 +233,7 @@ protected function compileUnion(array $union)
231
233
{
232
234
$ conjunction = $ union ['all ' ] ? ' union all ' : ' union ' ;
233
235
234
- return $ conjunction. '( ' . $ union ['query ' ]->toSql (). ') ' ;
236
+ return $ conjunction . '( ' . $ union ['query ' ]->toSql () . ') ' ;
235
237
}
236
238
237
239
/**
@@ -250,18 +252,18 @@ public function compileSelect(Builder $query)
250
252
}
251
253
252
254
if (! empty ($ query ->unionOrders ) || isset ($ query ->unionLimit ) || isset ($ query ->unionOffset )) {
253
- $ sql = 'SELECT * FROM ( ' . $ sql. ') ' ;
255
+ $ sql = 'SELECT * FROM ( ' . $ sql . ') ' ;
254
256
255
257
if (! empty ($ query ->unionOrders )) {
256
- $ sql .= ' ' . $ this ->compileOrders ($ query , $ query ->unionOrders );
258
+ $ sql .= ' ' . $ this ->compileOrders ($ query , $ query ->unionOrders );
257
259
}
258
260
259
261
if (isset ($ query ->unionLimit )) {
260
- $ sql .= ' ' . $ this ->compileLimit ($ query , $ query ->unionLimit );
262
+ $ sql .= ' ' . $ this ->compileLimit ($ query , $ query ->unionLimit );
261
263
}
262
264
263
265
if (isset ($ query ->unionOffset )) {
264
- $ sql .= ' ' . $ this ->compileUnionOffset ($ query , $ query ->unionOffset );
266
+ $ sql .= ' ' . $ this ->compileUnionOffset ($ query , $ query ->unionOffset );
265
267
}
266
268
}
267
269
@@ -295,10 +297,10 @@ private function compileOffsetWithLimit($offset, $limit): string
295
297
// Add a huge LIMIT clause
296
298
if (! isset ($ limit )) {
297
299
// 9223372036854775807 - max 64-bit integer
298
- return ' LIMIT 9223372036854775807 OFFSET ' . (int ) $ offset ;
300
+ return ' LIMIT 9223372036854775807 OFFSET ' . (int ) $ offset ;
299
301
}
300
302
301
- return ' OFFSET ' . (int ) $ offset ;
303
+ return ' OFFSET ' . (int ) $ offset ;
302
304
}
303
305
304
306
/**
0 commit comments