(this: &mut ZObj)
| 201 | } |
| 202 | |
| 203 | fn get_peer_by_this(this: &mut ZObj) -> Option<String> { |
| 204 | let handle = this.handle(); |
| 205 | |
| 206 | debug!(handle, "start to call mysqli_get_host_info"); |
| 207 | |
| 208 | let host_info = match call("mysqli_get_host_info", [ZVal::from(this.to_ref_owned())]) { |
| 209 | Ok(host_info) => host_info, |
| 210 | Err(err) => { |
| 211 | error!(handle, ?err, "call mysqli_get_host_info failed"); |
| 212 | return None; |
| 213 | } |
| 214 | }; |
| 215 | |
| 216 | host_info |
| 217 | .as_z_str() |
| 218 | .and_then(|info| info.to_str().ok()) |
| 219 | .and_then(|info| info.split(' ').next()) |
| 220 | .map(ToOwned::to_owned) |
| 221 | .map(|mut info| { |
| 222 | if !info.contains(':') { |
| 223 | info.push_str(":3306"); |
| 224 | } |
| 225 | info |
| 226 | }) |
| 227 | } |
| 228 | |
| 229 | fn get_peer_by_parameters(execute_data: &mut ExecuteData, style: ApiStyle) -> String { |
| 230 | let mut peer = "".to_owned(); |
no outgoing calls
no test coverage detected