@@ -727,7 +727,7 @@ function ( string $sql, array $params ) {
727727 #[ReturnTypeWillChange]
728728 public function query ( string $ query , ?int $ fetch_mode = PDO ::FETCH_COLUMN , ...$ fetch_mode_args ) {
729729 $ this ->flush ();
730- $ this ->pdo_fetch_mode = $ fetch_mode ;
730+ $ this ->pdo_fetch_mode = PDO :: FETCH_NUM ; // TODO
731731 $ this ->last_mysql_query = $ query ;
732732
733733 try {
@@ -772,8 +772,10 @@ public function query( string $query, ?int $fetch_mode = PDO::FETCH_COLUMN, ...$
772772 $ this ->commit_wrapper_transaction ();
773773 }
774774
775+ $ columns = is_array ( $ this ->last_column_meta ) ? $ this ->last_column_meta : array ();
776+ $ rows = is_array ( $ this ->last_result ) ? $ this ->last_result : array ();
775777 $ affected_rows = is_int ( $ this ->last_return_value ) ? $ this ->last_return_value : 0 ;
776- return new WP_PDO_Synthetic_Statement ( $ affected_rows );
778+ return new WP_PDO_Synthetic_Statement ( $ columns , $ rows , $ affected_rows );
777779 } catch ( Throwable $ e ) {
778780 try {
779781 $ this ->rollback_user_transaction ();
@@ -2444,7 +2446,7 @@ private function execute_show_statement( WP_Parser_Node $node ): void {
24442446 } else {
24452447 $ this ->set_results_from_fetched_data (
24462448 array (
2447- ( object ) array (
2449+ array (
24482450 'Table ' => $ table_name ,
24492451 'Create Table ' => $ sql ,
24502452 ),
@@ -2483,7 +2485,7 @@ private function execute_show_statement( WP_Parser_Node $node ): void {
24832485 case WP_MySQL_Lexer::GRANTS_SYMBOL :
24842486 $ this ->set_results_from_fetched_data (
24852487 array (
2486- ( object ) array (
2488+ array (
24872489 'Grants for root@% ' => 'GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, CREATE ROLE, DROP ROLE ON *.* TO `root`@`localhost` WITH GRANT OPTION ' ,
24882490 ),
24892491 )
@@ -2572,7 +2574,7 @@ private function execute_show_collation_statement( WP_Parser_Node $node ): void
25722574 )
25732575 );
25742576 $ this ->store_last_column_meta_from_statement ( $ stmt );
2575- $ this ->set_results_from_fetched_data ( $ stmt ->fetchAll ( PDO :: FETCH_OBJ ) );
2577+ $ this ->set_results_from_fetched_data ( $ stmt ->fetchAll ( $ this -> pdo_fetch_mode ) );
25762578 }
25772579
25782580 /**
@@ -2604,7 +2606,7 @@ private function execute_show_databases_statement( WP_Parser_Node $node ): void
26042606 );
26052607
26062608 $ this ->store_last_column_meta_from_statement ( $ stmt );
2607- $ databases = $ stmt ->fetchAll ( PDO :: FETCH_OBJ );
2609+ $ databases = $ stmt ->fetchAll ( $ this -> pdo_fetch_mode );
26082610 $ this ->set_results_from_fetched_data ( $ databases );
26092611 }
26102612
@@ -2690,7 +2692,7 @@ private function execute_show_index_statement( WP_Parser_Node $node ): void {
26902692 );
26912693
26922694 $ this ->store_last_column_meta_from_statement ( $ stmt );
2693- $ index_info = $ stmt ->fetchAll ( PDO :: FETCH_OBJ );
2695+ $ index_info = $ stmt ->fetchAll ( $ this -> pdo_fetch_mode );
26942696 $ this ->set_results_from_fetched_data ( $ index_info );
26952697 }
26962698
@@ -2753,7 +2755,7 @@ private function execute_show_table_status_statement( WP_Parser_Node $node ): vo
27532755 );
27542756
27552757 $ this ->store_last_column_meta_from_statement ( $ stmt );
2756- $ table_info = $ stmt ->fetchAll ( PDO :: FETCH_OBJ );
2758+ $ table_info = $ stmt ->fetchAll ( $ this -> pdo_fetch_mode );
27572759 if ( false === $ table_info ) {
27582760 $ this ->set_results_from_fetched_data ( array () );
27592761 }
@@ -2805,7 +2807,7 @@ private function execute_show_tables_statement( WP_Parser_Node $node ): void {
28052807 );
28062808
28072809 $ this ->store_last_column_meta_from_statement ( $ stmt );
2808- $ table_info = $ stmt ->fetchAll ( PDO :: FETCH_OBJ );
2810+ $ table_info = $ stmt ->fetchAll ( $ this -> pdo_fetch_mode );
28092811 if ( false === $ table_info ) {
28102812 $ this ->set_results_from_fetched_data ( array () );
28112813 }
@@ -2878,7 +2880,7 @@ private function execute_show_columns_statement( WP_Parser_Node $node ): void {
28782880 );
28792881
28802882 $ this ->store_last_column_meta_from_statement ( $ stmt );
2881- $ column_info = $ stmt ->fetchAll ( PDO :: FETCH_OBJ );
2883+ $ column_info = $ stmt ->fetchAll ( $ this -> pdo_fetch_mode );
28822884 if ( false === $ column_info ) {
28832885 $ this ->set_results_from_fetched_data ( array () );
28842886 }
@@ -2917,7 +2919,7 @@ private function execute_describe_statement( WP_Parser_Node $node ): void {
29172919 );
29182920
29192921 $ this ->store_last_column_meta_from_statement ( $ stmt );
2920- $ column_info = $ stmt ->fetchAll ( PDO :: FETCH_OBJ );
2922+ $ column_info = $ stmt ->fetchAll ( $ this -> pdo_fetch_mode );
29212923 $ this ->set_results_from_fetched_data ( $ column_info );
29222924 }
29232925
@@ -3239,14 +3241,14 @@ private function execute_administration_statement( WP_Parser_Node $node ): void
32393241
32403242 $ operation = strtolower ( $ first_token ->get_value () );
32413243 foreach ( $ errors as $ error ) {
3242- $ results [] = ( object ) array (
3244+ $ results [] = array (
32433245 'Table ' => $ this ->db_name . '. ' . $ table_name ,
32443246 'Op ' => $ operation ,
32453247 'Msg_type ' => 'Error ' ,
32463248 'Msg_text ' => $ error ,
32473249 );
32483250 }
3249- $ results [] = ( object ) array (
3251+ $ results [] = array (
32503252 'Table ' => $ this ->db_name . '. ' . $ table_name ,
32513253 'Op ' => $ operation ,
32523254 'Msg_type ' => 'status ' ,
0 commit comments