Skip to content

Commit 742abc8

Browse files
Merge branch 'PLAT-7239' of github.com:singlestore-labs/singlestoredb-laravel-driver into PLAT-7239
2 parents 086bee0 + d7d2a44 commit 742abc8

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/Query/Grammar.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function compileOptions(array $options): string
2626
if (! empty($optionString)) {
2727
$optionString .= ',';
2828
}
29-
$optionString .= $key . '=' . $value;
29+
$optionString .= $key.'='.$value;
3030
}
3131

3232
return "OPTION ({$optionString})";
@@ -128,7 +128,7 @@ protected function whereNull(Builder $query, $where)
128128
if ($this->isJsonSelector($columnValue)) {
129129
[$field, $path] = $this->wrapJsonFieldAndPath($where['column']);
130130

131-
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\')';
132132
}
133133

134134
return parent::whereNull($query, $where);
@@ -155,7 +155,7 @@ protected function whereNotNull(Builder $query, $where)
155155
if ($this->isJsonSelector($columnValue)) {
156156
[$field, $path] = $this->wrapJsonFieldAndPath($where['column']);
157157

158-
return '(JSON_EXTRACT_JSON(' . $field . $path . ') IS NOT NULL AND JSON_GET_TYPE(JSON_EXTRACT_JSON(' . $field . $path . ')) != \'NULL\')';
158+
return '(JSON_EXTRACT_JSON('.$field.$path.') IS NOT NULL AND JSON_GET_TYPE(JSON_EXTRACT_JSON('.$field.$path.')) != \'NULL\')';
159159
}
160160

161161
return parent::whereNotNull($query, $where);
@@ -207,7 +207,7 @@ protected function wrapJsonFieldAndPath($column)
207207
return "'$part'";
208208
}, $parts);
209209

210-
$path = count($parts) ? ', ' . implode(', ', $parts) : '';
210+
$path = count($parts) ? ', '.implode(', ', $parts) : '';
211211

212212
return [$field, $path];
213213
}
@@ -220,7 +220,7 @@ protected function wrapJsonFieldAndPath($column)
220220
*/
221221
protected function wrapUnion($sql)
222222
{
223-
return 'SELECT * FROM (' . $sql . ')';
223+
return 'SELECT * FROM ('.$sql.')';
224224
}
225225

226226
/**
@@ -248,7 +248,7 @@ protected function compileUnion(array $union)
248248
{
249249
$conjunction = $union['all'] ? ' union all ' : ' union ';
250250

251-
return $conjunction . '(' . $union['query']->toSql() . ')';
251+
return $conjunction.'('.$union['query']->toSql().')';
252252
}
253253

254254
/**
@@ -267,18 +267,18 @@ public function compileSelect(Builder $query)
267267
}
268268

269269
if (! empty($query->unionOrders) || isset($query->unionLimit) || isset($query->unionOffset)) {
270-
$sql = 'SELECT * FROM (' . $sql . ') ';
270+
$sql = 'SELECT * FROM ('.$sql.') ';
271271

272272
if (! empty($query->unionOrders)) {
273-
$sql .= ' ' . $this->compileOrders($query, $query->unionOrders);
273+
$sql .= ' '.$this->compileOrders($query, $query->unionOrders);
274274
}
275275

276276
if (isset($query->unionLimit)) {
277-
$sql .= ' ' . $this->compileLimit($query, $query->unionLimit);
277+
$sql .= ' '.$this->compileLimit($query, $query->unionLimit);
278278
}
279279

280280
if (isset($query->unionOffset)) {
281-
$sql .= ' ' . $this->compileUnionOffset($query, $query->unionOffset);
281+
$sql .= ' '.$this->compileUnionOffset($query, $query->unionOffset);
282282
}
283283
}
284284

@@ -312,10 +312,10 @@ private function compileOffsetWithLimit($offset, $limit): string
312312
// Add a huge LIMIT clause
313313
if (! isset($limit)) {
314314
// 9223372036854775807 - max 64-bit integer
315-
return ' LIMIT 9223372036854775807 OFFSET ' . (int) $offset;
315+
return ' LIMIT 9223372036854775807 OFFSET '.(int) $offset;
316316
}
317317

318-
return ' OFFSET ' . (int) $offset;
318+
return ' OFFSET '.(int) $offset;
319319
}
320320

321321
/**

tests/Hybrid/Json/JsonWhereTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function where_null_raw()
134134
$query = DB::table('test')->whereNull(DB::raw('(SELECT NULL)'))->orderBy('id');
135135

136136
$this->assertEquals(
137-
"select * from `test` where (SELECT NULL) is null order by `id` asc",
137+
'select * from `test` where (SELECT NULL) is null order by `id` asc',
138138
$query->toSql()
139139
);
140140

@@ -187,7 +187,7 @@ public function where_not_null_raw()
187187
$query = DB::table('test')->whereNotNull(DB::raw('(SELECT 1)'))->orderBy('id');
188188

189189
$this->assertEquals(
190-
"select * from `test` where (SELECT 1) is not null order by `id` asc",
190+
'select * from `test` where (SELECT 1) is not null order by `id` asc',
191191
$query->toSql()
192192
);
193193

0 commit comments

Comments
 (0)