Commit 1843539f authored by guilhermeblanco's avatar guilhermeblanco

[2.0] Fixes for DQL BNF

parent 34f4ee71
...@@ -45,44 +45,71 @@ DeleteStatement ::= DeleteClause [WhereClause] ...@@ -45,44 +45,71 @@ DeleteStatement ::= DeleteClause [WhereClause]
* IDENTIFIERS * IDENTIFIERS
*/ */
/* Alias Identification usage */ /* Alias Identification usage (the "u" of "u.name") */
IdentificationVariable ::= identifier IdentificationVariable ::= identifier
/* Alias Identification declaration */ /* Alias Identification declaration (the "u" of "FROM User u") */
AliasIdentificationVariable :: = identifier AliasIdentificationVariable :: = identifier
/* identifier that must be a class name */ /* identifier that must be a class name (the "User" of "FROM User u") */
AbstractSchemaName ::= identifier AbstractSchemaName ::= identifier
/* identifier that must be a field */ /* identifier that must be a field (the "name" of "u.name") */
/* This is responsable to know if the field exists in Object, no matter if it's a relation or a simple field */
FieldIdentificationVariable ::= identifier FieldIdentificationVariable ::= identifier
/* identifier that must be a collection-valued association field (to-many) */ /* identifier that must be a collection-valued association field (to-many) (the "Phonenumbers" of "u.Phonenumbers") */
CollectionValuedAssociationField ::= FieldIdentificationVariable CollectionValuedAssociationField ::= FieldIdentificationVariable
/* identifier that must be a single-valued association field (to-one) */ /* identifier that must be a single-valued association field (to-one) (the "Group" of "u.Group") */
SingleValuedAssociationField ::= FieldIdentificationVariable SingleValuedAssociationField ::= FieldIdentificationVariable
/* identifier that must be an embedded class state field (for the future) */ /* identifier that must be an embedded class state field (for the future) */
EmbeddedClassStateField ::= FieldIdentificationVariable EmbeddedClassStateField ::= FieldIdentificationVariable
/* identifier that must be a simple state field (name, email, ...) */ /* identifier that must be a simple state field (name, email, ...) (the "name" of "u.name") */
/* The difference between this and FieldIdentificationVariable is only semantical, because it points to a single field (not mapping to a relation) */
SimpleStateField ::= FieldIdentificationVariable SimpleStateField ::= FieldIdentificationVariable
/* identifier that must be unique among other mapped field aliases (the "total" of "COUNT(*) AS total")*/
FieldAliasIdentificationVariable = identifier
/* /*
* PATH EXPRESSIONS * PATH EXPRESSIONS
*/ */
/* "u.Group" or "u.Phonenumbers" declarations */
JoinAssociationPathExpression ::= JoinCollectionValuedPathExpression | JoinSingleValuedAssociationPathExpression JoinAssociationPathExpression ::= JoinCollectionValuedPathExpression | JoinSingleValuedAssociationPathExpression
/* "u.Phonenumbers" */
JoinCollectionValuedPathExpression ::= IdentificationVariable "." CollectionValuedAssociationField JoinCollectionValuedPathExpression ::= IdentificationVariable "." CollectionValuedAssociationField
/* "u.Group" */
JoinSingleValuedAssociationPathExpression ::= IdentificationVariable "." SingleValuedAssociationField JoinSingleValuedAssociationPathExpression ::= IdentificationVariable "." SingleValuedAssociationField
/* "u.Group" or "u.Phonenumbers" usages */
AssociationPathExpression ::= CollectionValuedPathExpression | SingleValuedAssociationPathExpression AssociationPathExpression ::= CollectionValuedPathExpression | SingleValuedAssociationPathExpression
/* "u.name" or "u.Group" */
SingleValuedPathExpression ::= StateFieldPathExpression | SingleValuedAssociationPathExpression SingleValuedPathExpression ::= StateFieldPathExpression | SingleValuedAssociationPathExpression
/* "u.name" or "u.Group.name" */
StateFieldPathExpression ::= SimpleStateFieldPathExpression | SimpleStateFieldAssociationPathExpression StateFieldPathExpression ::= SimpleStateFieldPathExpression | SimpleStateFieldAssociationPathExpression
/* "u.Group" */
SingleValuedAssociationPathExpression ::= IdentificationVariable "." {SingleValuedAssociationField "."}* SingleValuedAssociationField SingleValuedAssociationPathExpression ::= IdentificationVariable "." {SingleValuedAssociationField "."}* SingleValuedAssociationField
/* "u.Group.Permissions" */
CollectionValuedPathExpression ::= IdentificationVariable "." {SingleValuedAssociationField "."}* CollectionValuedAssociationField CollectionValuedPathExpression ::= IdentificationVariable "." {SingleValuedAssociationField "."}* CollectionValuedAssociationField
/* "name" */
StateField ::= {EmbeddedClassStateField "."}* SimpleStateField StateField ::= {EmbeddedClassStateField "."}* SimpleStateField
/* "u.name" */
SimpleStateFieldPathExpression ::= IdentificationVariable "." SimpleStateField SimpleStateFieldPathExpression ::= IdentificationVariable "." SimpleStateField
/* "u.Group.name" */
SimpleStateFieldAssociationPathExpression ::= SingleValuedAssociationPathExpression "." StateField SimpleStateFieldAssociationPathExpression ::= SingleValuedAssociationPathExpression "." StateField
...@@ -109,7 +136,7 @@ Subselect ::= SimpleSelectClause SubselectFromClause [WhereClause] [Gr ...@@ -109,7 +136,7 @@ Subselect ::= SimpleSelectClause SubselectFromClause [WhereClause] [Gr
*/ */
OrderByItem ::= StateFieldPathExpression ["ASC" | "DESC"] OrderByItem ::= StateFieldPathExpression ["ASC" | "DESC"]
GroupByItem ::= SingleValuedPathExpression GroupByItem ::= SingleValuedPathExpression
UpdateItem ::= [IdentificationVariable"."]{StateField | SingleValuedAssociationField} "=" NewValue UpdateItem ::= [IdentificationVariable "."] {StateField | SingleValuedAssociationField} "=" NewValue
NewValue ::= SimpleArithmeticExpression | StringPrimary | DatetimePrimary | BooleanPrimary | NewValue ::= SimpleArithmeticExpression | StringPrimary | DatetimePrimary | BooleanPrimary |
EnumPrimary | SimpleEntityExpression | "NULL" EnumPrimary | SimpleEntityExpression | "NULL"
...@@ -118,8 +145,7 @@ NewValue ::= SimpleArithmeticExpression | StringPrimary | DatetimePrimary | B ...@@ -118,8 +145,7 @@ NewValue ::= SimpleArithmeticExpression | StringPrimary | DatetimePrimary | B
* FROM/JOIN/INDEX BY * FROM/JOIN/INDEX BY
*/ */
IdentificationVariableDeclaration ::= RangeVariableDeclaration [IndexBy] {JoinVariableDeclaration}* IdentificationVariableDeclaration ::= RangeVariableDeclaration [IndexBy] {JoinVariableDeclaration}*
SubselectIdentificationVariableDeclaration ::= IdentificationVariableDeclaration | AssociationPathExpression SubselectIdentificationVariableDeclaration ::= IdentificationVariableDeclaration | (AssociationPathExpression ["AS"] AliasIdentificationVariable)
["AS"] AliasIdentificationVariable
JoinVariableDeclaration ::= Join [IndexBy] JoinVariableDeclaration ::= Join [IndexBy]
RangeVariableDeclaration ::= AbstractSchemaName ["AS"] AliasIdentificationVariable RangeVariableDeclaration ::= AbstractSchemaName ["AS"] AliasIdentificationVariable
Join ::= ["LEFT" ["OUTER"] | "INNER"] "JOIN" JoinAssociationPathExpression Join ::= ["LEFT" ["OUTER"] | "INNER"] "JOIN" JoinAssociationPathExpression
...@@ -130,9 +156,8 @@ IndexBy ::= "INDEX" "BY" SimpleStateFieldPath ...@@ -130,9 +156,8 @@ IndexBy ::= "INDEX" "BY" SimpleStateFieldPath
/* /*
* SELECT EXPRESSION * SELECT EXPRESSION
*/ */
SelectExpression ::= IdentificationVariable ["." "*"] | SelectExpression ::= IdentificationVariable ["." "*"] | StateFieldPathExpression |
(StateFieldPathExpression | AggregateExpression | (AggregateExpression | "(" Subselect ")") [["AS"] FieldAliasIdentificationVariable]
"(" Subselect ")" ) [["AS"] FieldIdentificationVariable]
SimpleSelectExpression ::= SingleValuedPathExpression | IdentificationVariable | AggregateExpression SimpleSelectExpression ::= SingleValuedPathExpression | IdentificationVariable | AggregateExpression
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment