diff --git a/src/sqlitetypes.cpp b/src/sqlitetypes.cpp index ca7dc7b02..3eeb88670 100644 --- a/src/sqlitetypes.cpp +++ b/src/sqlitetypes.cpp @@ -22,6 +22,48 @@ QStringList fieldVectorToFieldNames(const FieldVector& vector) return result; } +/** + * @brief The CreateTableWalker class + * Goes trough the createtable AST and returns + * Table object. + */ +class CreateTableWalker +{ +public: + explicit CreateTableWalker(antlr::RefAST r) + : m_root(r) + {} + + TablePtr table(); + +private: + void parsecolumn(Table* table, antlr::RefAST c); + +private: + antlr::RefAST m_root; +}; + +/** + * @brief The CreateIndexWalker class + * Goes trough the createtable AST and returns + * Index object. + */ +class CreateIndexWalker +{ +public: + explicit CreateIndexWalker(antlr::RefAST r) + : m_root(r) + {} + + IndexPtr index(); + +private: + void parsecolumn(Index* index, antlr::RefAST c); + +private: + antlr::RefAST m_root; +}; + ObjectPtr Object::parseSQL(Object::ObjectTypes type, const QString& sSQL) { // Parse SQL statement according to type diff --git a/src/sqlitetypes.h b/src/sqlitetypes.h index 5edc9d502..4610c86da 100644 --- a/src/sqlitetypes.h +++ b/src/sqlitetypes.h @@ -2,13 +2,10 @@ #ifndef SQLITETYPES_H #define SQLITETYPES_H -#include "antlr/ASTRefCount.hpp" - #include #include #include #include -#include #include namespace sqlb { @@ -29,6 +26,9 @@ typedef QSharedPointer ConstraintPtr; typedef QVector FieldVector; typedef QSharedPointer IndexedColumnPtr; typedef QVector IndexedColumnVector; +typedef QMultiHash ConstraintMap; + +QStringList fieldVectorToFieldNames(const sqlb::FieldVector& vector); class Object { @@ -217,8 +217,6 @@ class Field bool m_unique; }; -typedef QMultiHash ConstraintMap; - class Table : public Object { public: @@ -289,29 +287,6 @@ class Table : public Object QString m_virtual; }; -/** - * @brief The CreateTableWalker class - * Goes trough the createtable AST and returns - * Table object. - */ -class CreateTableWalker -{ -public: - explicit CreateTableWalker(antlr::RefAST r) - : m_root(r) - {} - - TablePtr table(); - -private: - void parsecolumn(Table* table, antlr::RefAST c); - -private: - antlr::RefAST m_root; -}; - -QStringList fieldVectorToFieldNames(const sqlb::FieldVector& vector); - class IndexedColumn { public: @@ -390,27 +365,6 @@ class Index : public Object IndexedColumnVector m_columns; }; -/** - * @brief The CreateIndexWalker class - * Goes trough the createtable AST and returns - * Index object. - */ -class CreateIndexWalker -{ -public: - explicit CreateIndexWalker(antlr::RefAST r) - : m_root(r) - {} - - IndexPtr index(); - -private: - void parsecolumn(Index* index, antlr::RefAST c); - -private: - antlr::RefAST m_root; -}; - } //namespace sqlb #endif // SQLITETYPES_H