use crate::parser::ast::Expression;
use crate::parser::token::Token;
#[derive(Debug, Clone, PartialEq)]
pub enum PlSqlStatement {
Declare(DeclareStatement),
Block(BlockStatement),
Assignment(AssignmentStatement),
If(IfStatement),
While(WhileStatement),
Sql(Box<crate::parser::ast::Statement>),
Return(Token),
Commit(Token),
Rollback(Token),
BeginTransaction(Token),
}
#[derive(Debug, Clone, PartialEq)]
pub struct VariableDeclaration {
pub name: String,
pub data_type: String,
pub default_value: Option<Expression>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct DeclareStatement {
pub token: Token,
pub declarations: Vec<VariableDeclaration>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct BlockStatement {
pub token: Token,
pub statements: Vec<PlSqlStatement>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct AssignmentStatement {
pub token: Token,
pub variable: String,
pub expression: Expression,
}
#[derive(Debug, Clone, PartialEq)]
pub struct IfStatement {
pub token: Token,
pub condition: Expression,
pub then_block: Vec<PlSqlStatement>,
pub else_block: Option<Vec<PlSqlStatement>>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct WhileStatement {
pub token: Token,
pub condition: Expression,
pub block: Vec<PlSqlStatement>,
}