#include #include #include namespace dbal { namespace query { enum class NodeType { Select, Insert, Update, Delete, Where, Join, OrderBy, Limit }; class ASTNode { public: NodeType type; std::string value; std::vector> children; ASTNode(NodeType t, const std::string& v = "") : type(t), value(v) {} void addChild(std::shared_ptr child) { children.push_back(child); } }; class AST { public: std::shared_ptr root; AST() : root(nullptr) {} explicit AST(std::shared_ptr r) : root(r) {} std::string toString() const { if (!root) return ""; return nodeToString(root); } private: std::string nodeToString(const std::shared_ptr& node) const { if (!node) return ""; std::string result = node->value; for (const auto& child : node->children) { result += " " + nodeToString(child); } return result; } }; } }