@@ -443,6 +443,16 @@ 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+ );
455+
446456 /**
447457 * Last executed MySQL query.
448458 *
@@ -775,7 +785,7 @@ public function query( string $query, ?int $fetch_mode = PDO::FETCH_COLUMN, ...$
775785 $ columns = is_array ( $ this ->last_column_meta ) ? $ this ->last_column_meta : array ();
776786 $ rows = is_array ( $ this ->last_result ) ? $ this ->last_result : array ();
777787 $ affected_rows = is_int ( $ this ->last_return_value ) ? $ this ->last_return_value : 0 ;
778- return new WP_PDO_Synthetic_Statement ( $ columns , $ rows , $ affected_rows );
788+ return new WP_PDO_Synthetic_Statement ( $ this , $ columns , $ rows , $ affected_rows );
779789 } catch ( Throwable $ e ) {
780790 try {
781791 $ this ->rollback_user_transaction ();
@@ -872,6 +882,29 @@ public function inTransaction(): bool {
872882 return $ this ->connection ->get_pdo ()->inTransaction ();
873883 }
874884
885+ /**
886+ * PDO API: Set a PDO attribute.
887+ *
888+ * @param int $attribute The attribute to set.
889+ * @param mixed $value The value of the attribute.
890+ * @return bool True on success, false on failure.
891+ */
892+ public function setAttribute ( $ attribute , $ value ): bool {
893+ $ this ->pdo_attributes [ $ attribute ] = $ value ;
894+ return true ;
895+ }
896+
897+ /**
898+ * PDO API: Get a PDO attribute.
899+ *
900+ * @param int $attribute The attribute to get.
901+ * @return mixed The value of the attribute.
902+ */
903+ #[ReturnTypeWillChange]
904+ public function getAttribute ( $ attribute ) {
905+ return $ this ->pdo_attributes [ $ attribute ] ?? null ;
906+ }
907+
875908 /**
876909 * Get the SQLite connection instance.
877910 *
0 commit comments