@@ -443,18 +443,6 @@ class WP_PDO_MySQL_On_SQLite extends PDO {
443443 */
444444 private $ information_schema_builder ;
445445
446- /**
447- * PDO API: The PDO attributes of the connection.
448- *
449- * TODO: Add PDO default attribute values.
450- *
451- * @var array<int, mixed>
452- */
453- private $ pdo_attributes = array (
454- // On PHP < 8.1, PDO::ATTR_STRINGIFY_FETCHES is enabled by default.
455- PDO ::ATTR_STRINGIFY_FETCHES => PHP_VERSION_ID < 80100 ? true : false ,
456- );
457-
458446 /**
459447 * Last executed MySQL query.
460448 *
@@ -787,7 +775,7 @@ public function query( string $query, ?int $fetch_mode = null, ...$fetch_mode_ar
787775
788776 // When the default FETCH_BOTH is not set explicitly, additional
789777 // arguments are ignored, and the argument count is not validated.
790- $ fetch_mode = PDO ::FETCH_BOTH ;
778+ $ fetch_mode = $ this -> connection -> get_pdo ()-> getAttribute ( PDO ::ATTR_DEFAULT_FETCH_MODE ) ;
791779 $ fetch_mode_args = array ();
792780 } elseif ( PDO ::FETCH_COLUMN === $ fetch_mode ) {
793781 if ( 3 !== $ arg_count ) {
@@ -1014,24 +1002,31 @@ public function inTransaction(): bool {
10141002 /**
10151003 * PDO API: Set a PDO attribute.
10161004 *
1005+ * TODO: Evaluate whether we should pass all PDO attributes to the PDO SQLite
1006+ * instance, or whether some of them require special handling.
1007+ * See: https://github.com/php/php-src/blob/b391c28f903536e3bc6a0021ae0976ddbc2745f8/ext/pdo/php_pdo_driver.h#L103
1008+ *
10171009 * @param int $attribute The attribute to set.
10181010 * @param mixed $value The value of the attribute.
10191011 * @return bool True on success, false on failure.
10201012 */
10211013 public function setAttribute ( $ attribute , $ value ): bool {
1022- $ this ->pdo_attributes [ $ attribute ] = $ value ;
1023- return true ;
1014+ return $ this ->connection ->get_pdo ()->setAttribute ( $ attribute , $ value );
10241015 }
10251016
10261017 /**
10271018 * PDO API: Get a PDO attribute.
10281019 *
1020+ * TODO: Evaluate whether we should get all PDO attributes from the PDO SQLite
1021+ * instance, or whether some of them require special handling.
1022+ * See: https://github.com/php/php-src/blob/b391c28f903536e3bc6a0021ae0976ddbc2745f8/ext/pdo/php_pdo_driver.h#L103
1023+ *
10291024 * @param int $attribute The attribute to get.
10301025 * @return mixed The value of the attribute.
10311026 */
10321027 #[ReturnTypeWillChange]
10331028 public function getAttribute ( $ attribute ) {
1034- return $ this ->pdo_attributes [ $ attribute ] ?? null ;
1029+ return $ this ->connection -> get_pdo ()-> getAttribute ( $ attribute ) ;
10351030 }
10361031
10371032 /**
0 commit comments