*/ private array $queries = []; /** * Prepare a statement and return a tracing wrapper. * * @param string $query SQL query. * @param array $options Driver options. * @return TracingPdoStatement|false */ #[\Override] public function prepare( string $query, array $options = [] ): TracingPdoStatement|false { $stmt = parent::prepare( $query, $options ); if ( $stmt === false ) { return false; } return new TracingPdoStatement( $stmt, $query, $this ); } /** * Record a query execution. * * @param string $sql The SQL query. * @param float $time Execution time in seconds. * @param string $caller Calling function/method. */ public function record_query( string $sql, float $time, string $caller ): void { $this->queries[] = [ 'sql' => $sql, 'time' => $time, 'caller' => $caller, ]; } /** * Get all recorded queries. * * @return array */ public function get_queries(): array { return $this->queries; } }