Sketched rough parser code construction including some SQL AST classes.
This commit is contained in:
parent
f3898599fd
commit
5b20f900fc
15 changed files with 459 additions and 4 deletions
58
core/SqlAstNode.h
Normal file
58
core/SqlAstNode.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#ifndef SQLASTNODE_H
|
||||
#define SQLASTNODE_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace SqlAst {
|
||||
|
||||
class Node {
|
||||
public:
|
||||
Node();
|
||||
//virtual Node* Clone() const = 0;
|
||||
};
|
||||
|
||||
class DDLNode: public Node {
|
||||
|
||||
};
|
||||
|
||||
class CreateTable: public Node {
|
||||
|
||||
};
|
||||
|
||||
|
||||
// Is there a benefit for having a common base for crud operations???
|
||||
class CrudNode: public Node {
|
||||
|
||||
};
|
||||
|
||||
|
||||
class Insert: public CrudNode {
|
||||
|
||||
};
|
||||
|
||||
/** Class for representing an identifier.
|
||||
*
|
||||
* This can still be multiple things like:
|
||||
* - name of alias, schema, table and or column
|
||||
* - name of function
|
||||
* - predefined symbol like LOCAL_TIME
|
||||
*
|
||||
* During parsing this cannot always be determined as an alias might be involved that hasn't been parsed yet
|
||||
* so we put a Identifier in the AST a follow up pass could determine what it actually as and act appropriatly
|
||||
*
|
||||
* An identifier can consist of following fields
|
||||
* - [[schema.]table.]column
|
||||
* - [alias.]column
|
||||
* - [schema.]table.function (for function taking a row of type table)
|
||||
* - alias.function (for function taking a row of type table)
|
||||
* - schema.function
|
||||
* - sql symbol like CURRENT_DATE
|
||||
*/
|
||||
class Identifier: public Node {
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // SQLASTNODE_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue