1
0
Fork 0

root page is u32

This commit is contained in:
Ishan Jain 2022-11-14 16:19:48 +05:30
parent df0c43e56a
commit dc7d7512a4
2 changed files with 9 additions and 8 deletions

View File

@ -62,12 +62,13 @@ impl<'a> ColumnValue<'a> {
} }
} }
pub fn read_u8(&self) -> u8 { pub fn read_u32(&self) -> u32 {
if let ColumnValue::U8(v) = self { match self {
*v ColumnValue::U8(v) => *v as u32,
} else { ColumnValue::U16(v) => *v as u32,
println!("{:?}", self); ColumnValue::U24(v) => *v as u32,
unreachable!() ColumnValue::U32(v) => *v as u32,
_ => unreachable!(),
} }
} }

View File

@ -5,7 +5,7 @@ pub struct Schema {
pub kind: String, pub kind: String,
pub name: String, pub name: String,
pub table_name: String, pub table_name: String,
pub root_page: u8, pub root_page: u32,
pub sql: String, pub sql: String,
} }
@ -16,7 +16,7 @@ impl Schema {
let kind = items.next()?.to_string(); let kind = items.next()?.to_string();
let name = items.next()?.to_string(); let name = items.next()?.to_string();
let table_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 sql = items.next()?.to_string();
let schema = Self { let schema = Self {