Skip to content

Commit 4aac70a

Browse files
committed
Document PDO fetch modes
1 parent 10a1bdb commit 4aac70a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

wp-includes/sqlite-ast/class-wp-pdo-synthetic-statement.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,21 @@ public function fetchAll( $mode = PDO::FETCH_DEFAULT, ...$args ): array {
8282
*
8383
* This class implements a complete PDOStatement interface on top of PHP arrays.
8484
* It is used for result sets that are composed or transformed in the PHP layer.
85+
*
86+
* PDO supports the following fetch modes:
87+
* - PDO::FETCH_DEFAULT: current default fetch mode (available from PHP 8.0)
88+
* - PDO::FETCH_BOTH: default
89+
* - PDO::FETCH_NUM: numeric array
90+
* - PDO::FETCH_ASSOC: associative array
91+
* - PDO::FETCH_NAMED: associative array retaining duplicate columns
92+
* - PDO::FETCH_COLUMN: single column value [1 extra arg]
93+
* - PDO::FETCH_KEY_PAIR: key-value pair
94+
* - PDO::FETCH_OBJ: object (stdClass)
95+
* - PDO::FETCH_CLASS: object (custom class) [1-2 extra args]
96+
* - PDO::FETCH_INTO: update an exisisting object, can't be used with fetchAll() [1 extra arg]
97+
* - PDO::FETCH_LAZY: lazy fetch via PDORow, can't be used with fetchAll()
98+
* - PDO::FETCH_BOUND: bind values to PHP variables, can't be used with fetchAll()
99+
* - PDO::FETCH_FUNC: custom function, only works with fetchAll(), can't be default [1 extra arg]
85100
*/
86101
class WP_PDO_Synthetic_Statement extends PDOStatement {
87102
use WP_PDO_Synthetic_Statement_PHP_Compat;

0 commit comments

Comments
 (0)