From 40f3d2eaf3fde43cfc1e4b067592f8b7da3ab6e6 Mon Sep 17 00:00:00 2001 From: Codetector Date: Fri, 26 Jul 2024 10:19:33 -0700 Subject: [PATCH] Refactor crate::OFtable --- Cargo.lock | 10 ++++++++++ Cargo.toml | 1 + src/innodb/table/field.rs | 0 src/innodb/{table.rs => table/mod.rs} | 5 ++++- src/innodb/table/row.rs | 0 5 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/innodb/table/field.rs rename src/innodb/{table.rs => table/mod.rs} (99%) create mode 100644 src/innodb/table/row.rs diff --git a/Cargo.lock b/Cargo.lock index e6652d6..02cf8e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -221,6 +221,7 @@ dependencies = [ "num_enum", "pretty-hex", "simple_endian", + "sqlparser", "tracing", "tracing-subscriber", ] @@ -385,6 +386,15 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "sqlparser" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a404d0e14905361b918cb8afdb73605e25c1d5029312bd9785142dcb3aa49e" +dependencies = [ + "log", +] + [[package]] name = "strsim" version = "0.11.1" diff --git a/Cargo.toml b/Cargo.toml index 803b56c..99da978 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ indicatif = "0.17.8" num_enum = "0.7.2" pretty-hex = "0.4.1" simple_endian = "0.3.2" +sqlparser = "0.49.0" tracing = "0.1.40" tracing-subscriber = "0.3.18" diff --git a/src/innodb/table/field.rs b/src/innodb/table/field.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/innodb/table.rs b/src/innodb/table/mod.rs similarity index 99% rename from src/innodb/table.rs rename to src/innodb/table/mod.rs index fb891a8..2c6285c 100644 --- a/src/innodb/table.rs +++ b/src/innodb/table/mod.rs @@ -1,3 +1,6 @@ +pub mod field; +pub mod row; + use anyhow::Result; use std::{collections::HashMap, i64, sync::Arc}; use tracing::{trace, warn}; @@ -290,7 +293,7 @@ mod test { #[test] fn test_field_parse_int() { let buf = [0xFFu8, 0xFF, 0xFF]; - let mut field = Field { + let field = Field { name: Default::default(), field_type: FieldType::MediumInt, nullable: false, diff --git a/src/innodb/table/row.rs b/src/innodb/table/row.rs new file mode 100644 index 0000000..e69de29