diff --git a/src/record.rs b/src/record.rs index bad1c6e..83b9e3c 100644 --- a/src/record.rs +++ b/src/record.rs @@ -62,12 +62,13 @@ impl<'a> ColumnValue<'a> { } } - pub fn read_u8(&self) -> u8 { - if let ColumnValue::U8(v) = self { - *v - } else { - println!("{:?}", self); - unreachable!() + pub fn read_u32(&self) -> u32 { + match self { + ColumnValue::U8(v) => *v as u32, + ColumnValue::U16(v) => *v as u32, + ColumnValue::U24(v) => *v as u32, + ColumnValue::U32(v) => *v as u32, + _ => unreachable!(), } } diff --git a/src/schema.rs b/src/schema.rs index 32c5503..9f4d119 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -5,7 +5,7 @@ pub struct Schema { pub kind: String, pub name: String, pub table_name: String, - pub root_page: u8, + pub root_page: u32, pub sql: String, } @@ -16,7 +16,7 @@ impl Schema { let kind = items.next()?.to_string(); let name = items.next()?.to_string(); let table_name = items.next()?.to_string(); - let root_page = items.next()?.read_u8(); + let root_page = items.next()?.read_u32(); let sql = items.next()?.to_string(); let schema = Self {