(&self)
| 85 | |
| 86 | impl PdoPlugin { |
| 87 | fn hook_pdo_construct(&self) -> (Box<BeforeExecuteHook>, Box<AfterExecuteHook>) { |
| 88 | ( |
| 89 | Box::new(|request_id, execute_data| { |
| 90 | validate_num_args(execute_data, 1)?; |
| 91 | |
| 92 | let this = get_this_mut(execute_data)?; |
| 93 | let handle = this.handle(); |
| 94 | hack_dtor(this, Some(pdo_dtor)); |
| 95 | |
| 96 | let dsn = execute_data.get_parameter(0); |
| 97 | let dsn = dsn.as_z_str().context("dsn isn't str")?.to_str()?; |
| 98 | debug!(dsn, handle, "construct PDO"); |
| 99 | |
| 100 | let dsn: Dsn = dsn.parse()?; |
| 101 | debug!(?dsn, "parse PDO dsn"); |
| 102 | |
| 103 | let span = create_exit_span_with_dsn(request_id, "PDO", "__construct", &dsn)?; |
| 104 | |
| 105 | DSN_MAP.insert(handle, dsn); |
| 106 | |
| 107 | Ok(Box::new(span)) |
| 108 | }), |
| 109 | Box::new(move |_, span, _, _| { |
| 110 | let mut span = span.downcast::<Span>().unwrap(); |
| 111 | log_exception(&mut *span); |
| 112 | Ok(()) |
| 113 | }), |
| 114 | ) |
| 115 | } |
| 116 | |
| 117 | fn hook_pdo_methods( |
| 118 | &self, function_name: &str, |
no test coverage detected