| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('ABSPATH')) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
/** |
| 8 |
* Copies wpdb execution state into the plugin's standard query result array. |
| 9 |
* |
| 10 |
* The query pipeline and recovery paths all need the same fields after each |
| 11 |
* initial query or retry. Centralizing the adapter keeps the result contract |
| 12 |
* consistent across SELECT, mutation, timeout fallback, table recovery, |
| 13 |
* and table-repair retry paths. |
| 14 |
*/ |
| 15 |
class ABJ_404_Solution_DatabaseWpdbResultHarvester { |
| 16 |
|
| 17 |
/** |
| 18 |
* @param array<string, mixed> $result |
| 19 |
* @return void |
| 20 |
*/ |
| 21 |
public function harvestWpdbResult(array &$result): void { |
| 22 |
global $wpdb; |
| 23 |
$result['last_error'] = (string)($wpdb->last_error ?? ''); |
| 24 |
$result['last_result'] = $wpdb->last_result ?? array(); |
| 25 |
$result['rows_affected'] = $wpdb->rows_affected ?? 0; |
| 26 |
$result['insert_id'] = $wpdb->insert_id ?? 0; |
| 27 |
} |
| 28 |
} |
| 29 |
|