(name: Option<&str>, text: &str, types: &[i32])
| 161 | } |
| 162 | |
| 163 | pub fn parse(name: Option<&str>, text: &str, types: &[i32]) -> Vec<u8> { |
| 164 | if let Some(name) = name |
| 165 | && name.len() > 63 |
| 166 | { |
| 167 | warn!( |
| 168 | "Postgres only supports 63 characters for query names. You supplied {len}", |
| 169 | len = name.len() |
| 170 | ); |
| 171 | } |
| 172 | |
| 173 | let mut writer = BufferWriter::default(); |
| 174 | writer |
| 175 | .add_cstring(name.unwrap_or("")) |
| 176 | .add_cstring(text) |
| 177 | .add_int16(types.len() as i16); |
| 178 | |
| 179 | for oid in types { |
| 180 | writer.add_int32(*oid); |
| 181 | } |
| 182 | |
| 183 | writer.flush(Some(CODE_PARSE)) |
| 184 | } |
| 185 | |
| 186 | pub fn bind(config: &BindConfig) -> Vec<u8> { |
| 187 | let mut writer = BufferWriter::default(); |
nothing calls this directly
no test coverage detected