File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,8 @@ public function execute($params = null): Result
124
124
new \ArrayIterator (
125
125
mb_stripos ($ statement , 'select ' ) === 0 ||
126
126
mb_stripos ($ statement , 'show ' ) === 0 ||
127
- mb_stripos ($ statement , 'describe ' ) === 0
127
+ mb_stripos ($ statement , 'describe ' ) === 0 ||
128
+ preg_match ('/with(.*)\)\s*select/ms ' , mb_strtolower ($ statement )) == 1
128
129
? $ this ->client ->select ($ statement )->rows ()
129
130
: $ this ->client ->write ($ statement )->rows ()
130
131
)
Original file line number Diff line number Diff line change @@ -243,4 +243,20 @@ public function testTrimChar(): void
243
243
244
244
$ this ->assertEquals ('t2 ' , $ result ->fetchOne ());
245
245
}
246
+
247
+ public function testWith (): void
248
+ {
249
+ $ result = $ this ->connection ->executeQuery ("
250
+ WITH subselect as (
251
+ SELECT id
252
+ FROM test_select_table
253
+ WHERE payload = 'v4'
254
+ )
255
+ SELECT *
256
+ FROM test_select_table tbl
257
+ JOIN subselect sub ON sub.id = tbl.id
258
+ " );
259
+
260
+ $ this ->assertEquals (2 , $ result ->columnCount ());
261
+ }
246
262
}
You can’t perform that action at this time.
0 commit comments