@@ -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 *
@@ -783,7 +793,7 @@ public function query( string $query, ?int $fetch_mode = PDO::FETCH_COLUMN, ...$
783793 $ columns = is_array ( $ this ->last_column_meta ) ? $ this ->last_column_meta : array ();
784794 $ rows = is_array ( $ this ->last_result ) ? $ this ->last_result : array ();
785795 $ affected_rows = is_int ( $ this ->last_return_value ) ? $ this ->last_return_value : 0 ;
786- return new WP_PDO_Synthetic_Statement ( $ columns , $ rows , $ affected_rows );
796+ return new WP_PDO_Synthetic_Statement ( $ this , $ columns , $ rows , $ affected_rows );
787797 } catch ( Throwable $ e ) {
788798 try {
789799 $ this ->rollback_user_transaction ();
@@ -880,6 +890,29 @@ public function inTransaction(): bool {
880890 return $ this ->connection ->get_pdo ()->inTransaction ();
881891 }
882892
893+ /**
894+ * PDO API: Set a PDO attribute.
895+ *
896+ * @param int $attribute The attribute to set.
897+ * @param mixed $value The value of the attribute.
898+ * @return bool True on success, false on failure.
899+ */
900+ public function setAttribute ( $ attribute , $ value ): bool {
901+ $ this ->pdo_attributes [ $ attribute ] = $ value ;
902+ return true ;
903+ }
904+
905+ /**
906+ * PDO API: Get a PDO attribute.
907+ *
908+ * @param int $attribute The attribute to get.
909+ * @return mixed The value of the attribute.
910+ */
911+ #[ReturnTypeWillChange]
912+ public function getAttribute ( $ attribute ) {
913+ return $ this ->pdo_attributes [ $ attribute ] ?? null ;
914+ }
915+
883916 /**
884917 * Get the SQLite connection instance.
885918 *
0 commit comments