Handle floating-point values
(
&self,
real_val: f64,
pg_type_oid: i32,
binary_format: bool,
)
| 220 | |
| 221 | /// Handle floating-point values |
| 222 | fn handle_real_value( |
| 223 | &self, |
| 224 | real_val: f64, |
| 225 | pg_type_oid: i32, |
| 226 | binary_format: bool, |
| 227 | ) -> io::Result<Option<MappedValue>> { |
| 228 | // Try to use small value optimization for text format |
| 229 | if !binary_format |
| 230 | && let Some(small) = crate::protocol::SmallValue::from_float(real_val) { |
| 231 | return Ok(Some(MappedValue::Small(small))); |
| 232 | } |
| 233 | |
| 234 | let pg_data = if binary_format { |
| 235 | self.convert_real_binary(real_val, pg_type_oid) |
| 236 | } else { |
| 237 | real_val.to_string().into_bytes() |
| 238 | }; |
| 239 | |
| 240 | Ok(Some(MappedValue::Memory(pg_data))) |
| 241 | } |
| 242 | |
| 243 | /// Convert BLOB to PostgreSQL format |
| 244 | fn convert_blob_to_pg_format(&self, blob_data: &[u8], pg_type_oid: i32, binary_format: bool) -> Vec<u8> { |
no test coverage detected