Skip to content

Commit

Permalink
[#68] AST에 TCL 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
myyrakle committed Mar 16, 2024
1 parent 4ccb05d commit 60d0083
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"rust-analyzer.linkedProjects": [
".\\Cargo.toml",
".\\Cargo.toml"
]
}
11 changes: 11 additions & 0 deletions src/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pub mod dcl;
pub mod ddl;
pub mod dml;
pub mod other;
pub mod tcl;
pub mod types;

use crate::ast::{
Expand All @@ -19,11 +20,14 @@ use crate::ast::{
},
};

use self::tcl::{BeginTransactionQuery, CommitQuery, RollbackQuery};

#[derive(Clone, Debug, PartialEq)]
pub enum SQLStatement {
DDL(DDLStatement),
DML(DMLStatement),
DCL(DCLStatement),
TCL(TCLStatement),
Other(OtherStatement),
}

Expand Down Expand Up @@ -56,3 +60,10 @@ pub enum OtherStatement {
ShowTables(ShowTablesQuery),
DescTable(DescTableQuery),
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub enum TCLStatement {
BeginTransaction(BeginTransactionQuery),
Commit(CommitQuery),
Rollback(RollbackQuery),
}
2 changes: 2 additions & 0 deletions src/ast/tcl/begin_transaction.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct BeginTransactionQuery {}
2 changes: 2 additions & 0 deletions src/ast/tcl/commit.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CommitQuery {}
7 changes: 7 additions & 0 deletions src/ast/tcl/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
mod begin_transaction;
mod commit;
mod rollback;

pub use begin_transaction::*;
pub use commit::*;
pub use rollback::*;
2 changes: 2 additions & 0 deletions src/ast/tcl/rollback.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RollbackQuery {}

0 comments on commit 60d0083

Please sign in to comment.