summaryrefslogtreecommitdiff
path: root/hobgoblin/src/output/lang/sql
diff options
context:
space:
mode:
Diffstat (limited to 'hobgoblin/src/output/lang/sql')
-rw-r--r--hobgoblin/src/output/lang/sql/ast.hob31
1 files changed, 31 insertions, 0 deletions
diff --git a/hobgoblin/src/output/lang/sql/ast.hob b/hobgoblin/src/output/lang/sql/ast.hob
index d70e7bc..16e7b64 100644
--- a/hobgoblin/src/output/lang/sql/ast.hob
+++ b/hobgoblin/src/output/lang/sql/ast.hob
@@ -8,6 +8,7 @@ struct SqlScript {
sum SqlStatement {
variant SqlCreateTableStatement;
+ variant SqlSelectStatement;
}
struct SqlCreateTableStatement {
@@ -21,6 +22,21 @@ struct SqlColumnDefinition {
field typeName: SqlIdentifier;
}
+struct SqlSelectStatement {
+ field columns: List[SqlResultColumn];
+ field from: SqlIdentifier;
+ field orderBy: List[SqlOrderingTerm];
+}
+
+struct SqlResultColumn {
+ field expression: SqlExpression;
+ field alias: SqlIdentifier;
+}
+
+struct SqlOrderingTerm {
+ field expression: SqlExpression;
+}
+
// == Table constraints ==
sum SqlTableConstraint {
@@ -31,6 +47,21 @@ struct SqlPrimaryKeyConstraint {
field columns: List[SqlIdentifier];
}
+// == Expressions ==
+
+sum SqlExpression {
+ variant SqlIntLiteral;
+ variant SqlRef;
+}
+
+struct SqlIntLiteral {
+ field value: Int64;
+}
+
+struct SqlRef {
+ field name: SqlIdentifier;
+}
+
// == Identifiers ==
struct SqlIdentifier {