MCPcopy Create free account
hub / github.com/erans/pgsqlite / handle_real_value

Method handle_real_value

src/protocol/value_handler.rs:222–241  ·  view source on GitHub ↗

Handle floating-point values

(
        &self,
        real_val: f64,
        pg_type_oid: i32,
        binary_format: bool,
    )

Source from the content-addressed store, hash-verified

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> {

Callers 2

convert_valueMethod · 0.80
handle_text_valueMethod · 0.80

Calls 1

convert_real_binaryMethod · 0.80

Tested by

no test coverage detected