fn hook_pdo_statement_methods()

in src/plugin/plugin_pdo.rs [143:168]


    fn hook_pdo_statement_methods(
        &self, function_name: &str,
    ) -> (Box<BeforeExecuteHook>, Box<AfterExecuteHook>) {
        let function_name = function_name.to_owned();
        (
            Box::new(move |request_id, execute_data| {
                let this = get_this_mut(execute_data)?;
                let handle = this.handle();

                debug!(handle, function_name, "call PDOStatement method");

                let mut span = with_dsn(handle, |dsn| {
                    create_exit_span_with_dsn(request_id, "PDOStatement", &function_name, dsn)
                })?;

                if let Some(query) = this.get_property("queryString").as_z_str() {
                    span.add_tag(TAG_DB_STATEMENT, query.to_str()?);
                } else {
                    warn!("PDOStatement queryString is empty");
                }

                Ok(Box::new(span) as _)
            }),
            Box::new(after_hook),
        )
    }