Add parsing (incl. validation)
Ensure identifiers start with alphabetical character Rename parse_variable_name -> parse_column_name Add DB value parsers and condition parser placeholder Fix number parser, basic condition parser Move select parser to select module Add create statement parser Move condition parser to common; add delete statement parser Add drop statement parser Add insert parser Add update parser, combine operation parsers into one Add initial validation, fix compiler warnings Validation WIP Allow more spaces in create statement, update TableSchema struct Add create index parser and validator Add todo in parse_identifier Rework the new structure, many other changes
This commit is contained in:
parent
143dc0e5ce
commit
61c0a34253
20 changed files with 1138 additions and 39 deletions
|
|
@ -31,7 +31,7 @@ async fn main() -> anyhow::Result<()> {
|
|||
query: "SELECT * FROM users;".to_string().into(),
|
||||
})).await?;
|
||||
writer.flush().await?;
|
||||
|
||||
let mut line = String::new();
|
||||
loop {
|
||||
let msg: BackendMessage = reader.read_proto().await?;
|
||||
match msg {
|
||||
|
|
@ -46,7 +46,17 @@ async fn main() -> anyhow::Result<()> {
|
|||
},
|
||||
BackendMessage::ReadyForQuery(data) => {
|
||||
println!("Ready for query: {:?}", data);
|
||||
break;
|
||||
line.clear();
|
||||
let res = std::io::stdin().read_line(&mut line);
|
||||
if let Ok(_) = res {
|
||||
if line.eq("exit") {
|
||||
break;
|
||||
}
|
||||
writer.write_proto(FrontendMessage::Query(QueryData {
|
||||
query: line.clone().into(),
|
||||
})).await?;
|
||||
writer.flush().await?;
|
||||
}
|
||||
},
|
||||
m => {
|
||||
println!("Unexpected message: {:?}", m);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue