1
0

Debugging issues in tests

This commit is contained in:
Ishan Jain 2022-07-26 14:46:43 +05:30
parent f383e5566a
commit 679cf019dd

View File

@ -102,6 +102,9 @@ fn read_columns(query: &str, db_header: DBHeader, database: &[u8]) -> Result<(),
let (columns, table) = read_column_and_table(query); let (columns, table) = read_column_and_table(query);
// Assume it's valid SQL // Assume it's valid SQL
println!("{:?}", columns);
println!("{:?}", db_header);
let schema = db_header let schema = db_header
.schemas .schemas
.into_iter() .into_iter()
@ -110,6 +113,8 @@ fn read_columns(query: &str, db_header: DBHeader, database: &[u8]) -> Result<(),
let column_map = find_column_positions(&schema.sql); let column_map = find_column_positions(&schema.sql);
println!("column map = {:?}", column_map);
let table_page_offset = db_header.page_size as usize * (schema.root_page as usize - 1); let table_page_offset = db_header.page_size as usize * (schema.root_page as usize - 1);
let page_header = let page_header =
PageHeader::parse(&database[table_page_offset..table_page_offset + 8]).unwrap(); PageHeader::parse(&database[table_page_offset..table_page_offset + 8]).unwrap();
@ -136,6 +141,7 @@ fn read_columns(query: &str, db_header: DBHeader, database: &[u8]) -> Result<(),
Ok(()) Ok(())
} }
#[derive(Debug)]
struct DBHeader { struct DBHeader {
page_size: u16, page_size: u16,
schemas: Vec<Schema>, schemas: Vec<Schema>,