(message: &RawBackendMessage)
| 1281 | } |
| 1282 | |
| 1283 | fn error_sqlstate(message: &RawBackendMessage) -> Option<String> { |
| 1284 | let mut cursor = 0usize; |
| 1285 | while cursor < message.body.len() { |
| 1286 | let field = message.body[cursor]; |
| 1287 | cursor += 1; |
| 1288 | if field == 0 { |
| 1289 | break; |
| 1290 | } |
| 1291 | let end = message.body[cursor..] |
| 1292 | .iter() |
| 1293 | .position(|byte| *byte == 0) |
| 1294 | .map(|offset| cursor + offset)?; |
| 1295 | if field == b'C' { |
| 1296 | return Some(String::from_utf8_lossy(&message.body[cursor..end]).into_owned()); |
| 1297 | } |
| 1298 | cursor = end + 1; |
| 1299 | } |
| 1300 | None |
| 1301 | } |
no test coverage detected