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
124124 new \ArrayIterator (
125125 mb_stripos ($ statement , 'select ' ) === 0 ||
126126 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
128129 ? $ this ->client ->select ($ statement )->rows ()
129130 : $ this ->client ->write ($ statement )->rows ()
130131 )
Original file line number Diff line number Diff line change @@ -243,4 +243,20 @@ public function testTrimChar(): void
243243
244244 $ this ->assertEquals ('t2 ' , $ result ->fetchOne ());
245245 }
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+ }
246262}
You can’t perform that action at this time.
0 commit comments