From 4c826923a51c0a015c0d2b59f556ee99319eaaeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jind=C5=99ich=20Moravec?= Date: Tue, 23 Jan 2024 21:58:00 +0100 Subject: [PATCH] fix: type size bit length --- minisql/src/error.rs | 4 ++-- minisql/src/type_system.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/minisql/src/error.rs b/minisql/src/error.rs index 0574aff..2552f74 100644 --- a/minisql/src/error.rs +++ b/minisql/src/error.rs @@ -36,9 +36,9 @@ pub enum TypeConversionError { NumberDecodeFailed(#[from] ParseFloatError), #[error("failed to parse int from text")] IntDecodeFailed(#[from] ParseIntError), - #[error("uknown type with oid {oid} and size {size}")] + #[error("unknown type with oid {oid} and size {size}")] UnknownType { oid: i32, - size: i32 + size: i16 } } diff --git a/minisql/src/type_system.rs b/minisql/src/type_system.rs index caa85ab..03cfb13 100644 --- a/minisql/src/type_system.rs +++ b/minisql/src/type_system.rs @@ -53,7 +53,7 @@ impl Value { } } - pub fn type_size(&self) -> i32 { + pub fn type_size(&self) -> i16 { match self { Self::Number(_) => 8, Self::Indexable(val) => match val { @@ -75,7 +75,7 @@ impl Value { } } - pub fn from_text_bytes(bytes: &[u8], type_oid: i32, type_size: i32) -> Result { + pub fn from_text_bytes(bytes: &[u8], type_oid: i32, type_size: i16) -> Result { match (type_oid, type_size) { (701, 8) => { let s = std::str::from_utf8(bytes)?;