Skip to content

Instantly share code, notes, and snippets.

@Majkl578
Created September 17, 2017 05:31
Show Gist options
  • Save Majkl578/58b2f0cec714c2c952999a218eb5f73b to your computer and use it in GitHub Desktop.
Save Majkl578/58b2f0cec714c2c952999a218eb5f73b to your computer and use it in GitHub Desktop.
DQL:
DELETE FROM Foo f WHERE f.x = true AND NOT f.y IN (1, ?2, :abc, 'z')
HOA AST:
> #QueryLanguage
> > #DeleteStatement
> > > #DeleteClause
> > > > #AbstractSchemaName
> > > > #AliasIdentificationVariable
> > > #WhereClause
> > > > #ConditionalExpression
> > > > > #ConditionalTerm
> > > > > > #ConditionalFactor
> > > > > > > #ConditionalPrimary
> > > > > > > > #SimpleConditionalExpression
> > > > > > > > > #ComparisonExpression
> > > > > > > > > > #ArithmeticExpression
> > > > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > > > #SingleValuedPathExpression
> > > > > > > > > > > > > > > > #StateFieldPathExpression
> > > > > > > > > > > > > > > > > #IdentificationVariable
> > > > > > > > > > > > > > > > > #StateField
> > > > > > > > > > > > > > > > > > #SimpleStateField
> > > > > > > > > > > > > > > > > > > #FieldIdentificationVariable
> > > > > > > > > > #ComparisonOperator
> > > > > > > > > > #ArithmeticExpression
> > > > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > > > #Literal
> > > > > > #ConditionalFactor
> > > > > > > #ConditionalPrimary
> > > > > > > > #SimpleConditionalExpression
> > > > > > > > > #InExpression
> > > > > > > > > > #SingleValuedPathExpression
> > > > > > > > > > > #StateFieldPathExpression
> > > > > > > > > > > > #IdentificationVariable
> > > > > > > > > > > > #StateField
> > > > > > > > > > > > > #SimpleStateField
> > > > > > > > > > > > > > #FieldIdentificationVariable
> > > > > > > > > > #InParameter
> > > > > > > > > > > #Literal
> > > > > > > > > > #InParameter
> > > > > > > > > > > #InputParameter
> > > > > > > > > > > > #PositionalParameter
> > > > > > > > > > #InParameter
> > > > > > > > > > > #InputParameter
> > > > > > > > > > > > #NamedParameter
> > > > > > > > > > #InParameter
> > > > > > > > > > > #Literal
DQL:
select u.id from Doctrine\Tests\Models\CMS\CmsUser u where u.username = ?1
HOA AST:
> #QueryLanguage
> > #SelectStatement
> > > #SelectClause
> > > > #SelectExpression
> > > > > #ScalarExpression
> > > > > > #SimpleArithmeticExpression
> > > > > > > #ArithmeticTerm
> > > > > > > > #ArithmeticFactor
> > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > #SingleValuedPathExpression
> > > > > > > > > > > #StateFieldPathExpression
> > > > > > > > > > > > #IdentificationVariable
> > > > > > > > > > > > #StateField
> > > > > > > > > > > > > #SimpleStateField
> > > > > > > > > > > > > > #FieldIdentificationVariable
> > > #FromClause
> > > > #IdentificationVariableDeclaration
> > > > > #RangeVariableDeclaration
> > > > > > #AbstractSchemaName
> > > > > > #AliasIdentificationVariable
> > > #WhereClause
> > > > #ConditionalExpression
> > > > > #ConditionalTerm
> > > > > > #ConditionalFactor
> > > > > > > #ConditionalPrimary
> > > > > > > > #SimpleConditionalExpression
> > > > > > > > > #ComparisonExpression
> > > > > > > > > > #ArithmeticExpression
> > > > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > > > #SingleValuedPathExpression
> > > > > > > > > > > > > > > > #StateFieldPathExpression
> > > > > > > > > > > > > > > > > #IdentificationVariable
> > > > > > > > > > > > > > > > > #StateField
> > > > > > > > > > > > > > > > > > #SimpleStateField
> > > > > > > > > > > > > > > > > > > #FieldIdentificationVariable
> > > > > > > > > > #ComparisonOperator
> > > > > > > > > > #ArithmeticExpression
> > > > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > > > #InputParameter
> > > > > > > > > > > > > > > > #PositionalParameter
DQL:
SELECT c.id FROM Doctrine\Tests\Models\Company\CompanyPerson c JOIN Doctrine\Tests\Models\Company\CompanyPerson r WHERE c.spouse = r AND r.id = 42 AND r.name = 'abc'
HOA AST:
> #QueryLanguage
> > #SelectStatement
> > > #SelectClause
> > > > #SelectExpression
> > > > > #ScalarExpression
> > > > > > #SimpleArithmeticExpression
> > > > > > > #ArithmeticTerm
> > > > > > > > #ArithmeticFactor
> > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > #SingleValuedPathExpression
> > > > > > > > > > > #StateFieldPathExpression
> > > > > > > > > > > > #IdentificationVariable
> > > > > > > > > > > > #StateField
> > > > > > > > > > > > > #SimpleStateField
> > > > > > > > > > > > > > #FieldIdentificationVariable
> > > #FromClause
> > > > #IdentificationVariableDeclaration
> > > > > #RangeVariableDeclaration
> > > > > > #AbstractSchemaName
> > > > > > #AliasIdentificationVariable
> > > > > #Join
> > > > > > #RangeVariableDeclaration
> > > > > > > #AbstractSchemaName
> > > > > > > #AliasIdentificationVariable
> > > #WhereClause
> > > > #ConditionalExpression
> > > > > #ConditionalTerm
> > > > > > #ConditionalFactor
> > > > > > > #ConditionalPrimary
> > > > > > > > #SimpleConditionalExpression
> > > > > > > > > #ComparisonExpression
> > > > > > > > > > #ArithmeticExpression
> > > > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > > > #SingleValuedPathExpression
> > > > > > > > > > > > > > > > #StateFieldPathExpression
> > > > > > > > > > > > > > > > > #IdentificationVariable
> > > > > > > > > > > > > > > > > #StateField
> > > > > > > > > > > > > > > > > > #SimpleStateField
> > > > > > > > > > > > > > > > > > > #FieldIdentificationVariable
> > > > > > > > > > #ComparisonOperator
> > > > > > > > > > #ArithmeticExpression
> > > > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > > > #IdentificationVariable
> > > > > > #ConditionalFactor
> > > > > > > #ConditionalPrimary
> > > > > > > > #SimpleConditionalExpression
> > > > > > > > > #ComparisonExpression
> > > > > > > > > > #ArithmeticExpression
> > > > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > > > #SingleValuedPathExpression
> > > > > > > > > > > > > > > > #StateFieldPathExpression
> > > > > > > > > > > > > > > > > #IdentificationVariable
> > > > > > > > > > > > > > > > > #StateField
> > > > > > > > > > > > > > > > > > #SimpleStateField
> > > > > > > > > > > > > > > > > > > #FieldIdentificationVariable
> > > > > > > > > > #ComparisonOperator
> > > > > > > > > > #ArithmeticExpression
> > > > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > > > #Literal
> > > > > > #ConditionalFactor
> > > > > > > #ConditionalPrimary
> > > > > > > > #SimpleConditionalExpression
> > > > > > > > > #ComparisonExpression
> > > > > > > > > > #ArithmeticExpression
> > > > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > > > #SingleValuedPathExpression
> > > > > > > > > > > > > > > > #StateFieldPathExpression
> > > > > > > > > > > > > > > > > #IdentificationVariable
> > > > > > > > > > > > > > > > > #StateField
> > > > > > > > > > > > > > > > > > #SimpleStateField
> > > > > > > > > > > > > > > > > > > #FieldIdentificationVariable
> > > > > > > > > > #ComparisonOperator
> > > > > > > > > > #ArithmeticExpression
> > > > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > > > #Literal
DQL:
select u.id, (SELECT COUNT(z.foo) FROM Abc\Def z WHERE z.cost BETWEEN 1 AND 25) from Doctrine\Tests\Models\CMS\CmsUser u where u.username = ?1
HOA AST:
> #QueryLanguage
> > #SelectStatement
> > > #SelectClause
> > > > #SelectExpression
> > > > > #ScalarExpression
> > > > > > #SimpleArithmeticExpression
> > > > > > > #ArithmeticTerm
> > > > > > > > #ArithmeticFactor
> > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > #SingleValuedPathExpression
> > > > > > > > > > > #StateFieldPathExpression
> > > > > > > > > > > > #IdentificationVariable
> > > > > > > > > > > > #StateField
> > > > > > > > > > > > > #SimpleStateField
> > > > > > > > > > > > > > #FieldIdentificationVariable
> > > > #SelectExpression
> > > > > #Subselect
> > > > > > #SimpleSelectClause
> > > > > > > #SimpleSelectExpression
> > > > > > > > #AggregateExpression
> > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > #SingleValuedPathExpression
> > > > > > > > > > > > > > #StateFieldPathExpression
> > > > > > > > > > > > > > > #IdentificationVariable
> > > > > > > > > > > > > > > #StateField
> > > > > > > > > > > > > > > > #SimpleStateField
> > > > > > > > > > > > > > > > > #FieldIdentificationVariable
> > > > > > #SubselectFromClause
> > > > > > > #SubselectIdentificationVariableDeclaration
> > > > > > > > #IdentificationVariableDeclaration
> > > > > > > > > #RangeVariableDeclaration
> > > > > > > > > > #AbstractSchemaName
> > > > > > > > > > #AliasIdentificationVariable
> > > > > > #WhereClause
> > > > > > > #ConditionalExpression
> > > > > > > > #ConditionalTerm
> > > > > > > > > #ConditionalFactor
> > > > > > > > > > #ConditionalPrimary
> > > > > > > > > > > #SimpleConditionalExpression
> > > > > > > > > > > > #BetweenExpression
> > > > > > > > > > > > > #ArithmeticExpression
> > > > > > > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > > > > > > #SingleValuedPathExpression
> > > > > > > > > > > > > > > > > > > #StateFieldPathExpression
> > > > > > > > > > > > > > > > > > > > #IdentificationVariable
> > > > > > > > > > > > > > > > > > > > #StateField
> > > > > > > > > > > > > > > > > > > > > #SimpleStateField
> > > > > > > > > > > > > > > > > > > > > > #FieldIdentificationVariable
> > > > > > > > > > > > > #ArithmeticExpression
> > > > > > > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > > > > > > #Literal
> > > > > > > > > > > > > #ArithmeticExpression
> > > > > > > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > > > > > > #Literal
> > > #FromClause
> > > > #IdentificationVariableDeclaration
> > > > > #RangeVariableDeclaration
> > > > > > #AbstractSchemaName
> > > > > > #AliasIdentificationVariable
> > > #WhereClause
> > > > #ConditionalExpression
> > > > > #ConditionalTerm
> > > > > > #ConditionalFactor
> > > > > > > #ConditionalPrimary
> > > > > > > > #SimpleConditionalExpression
> > > > > > > > > #ComparisonExpression
> > > > > > > > > > #ArithmeticExpression
> > > > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > > > #SingleValuedPathExpression
> > > > > > > > > > > > > > > > #StateFieldPathExpression
> > > > > > > > > > > > > > > > > #IdentificationVariable
> > > > > > > > > > > > > > > > > #StateField
> > > > > > > > > > > > > > > > > > #SimpleStateField
> > > > > > > > > > > > > > > > > > > #FieldIdentificationVariable
> > > > > > > > > > #ComparisonOperator
> > > > > > > > > > #ArithmeticExpression
> > > > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > > > #InputParameter
> > > > > > > > > > > > > > > > #PositionalParameter
DQL:
SELECT CASE WHEN LENGTH(u.name) <> 0 THEN CONCAT(u.id, u.name) ELSE u.id END AS name FROM Doctrine\Tests\Models\CMS\CmsUser u
HOA AST:
> #QueryLanguage
> > #SelectStatement
> > > #SelectClause
> > > > #SelectExpression
> > > > > #ScalarExpression
> > > > > > #SimpleArithmeticExpression
> > > > > > > #ArithmeticTerm
> > > > > > > > #ArithmeticFactor
> > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > #CaseExpression
> > > > > > > > > > > #GeneralCaseExpression
> > > > > > > > > > > > #WhenClause
> > > > > > > > > > > > > #ConditionalExpression
> > > > > > > > > > > > > > #ConditionalTerm
> > > > > > > > > > > > > > > #ConditionalFactor
> > > > > > > > > > > > > > > > #ConditionalPrimary
> > > > > > > > > > > > > > > > > #SimpleConditionalExpression
> > > > > > > > > > > > > > > > > > #ComparisonExpression
> > > > > > > > > > > > > > > > > > > #ArithmeticExpression
> > > > > > > > > > > > > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > > > > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > > > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > > > > > > > > > > > > #FunctionsReturningNumerics
> > > > > > > > > > > > > > > > > > > > > > > > > #StringPrimary
> > > > > > > > > > > > > > > > > > > > > > > > > > #StateFieldPathExpression
> > > > > > > > > > > > > > > > > > > > > > > > > > > #IdentificationVariable
> > > > > > > > > > > > > > > > > > > > > > > > > > > #StateField
> > > > > > > > > > > > > > > > > > > > > > > > > > > > #SimpleStateField
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > #FieldIdentificationVariable
> > > > > > > > > > > > > > > > > > > #ComparisonOperator
> > > > > > > > > > > > > > > > > > > #ArithmeticExpression
> > > > > > > > > > > > > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > > > > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > > > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > > > > > > > > > > > > #Literal
> > > > > > > > > > > > > #ScalarExpression
> > > > > > > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > > > > > > #FunctionsReturningStrings
> > > > > > > > > > > > > > > > > > > #StringPrimary
> > > > > > > > > > > > > > > > > > > > #StateFieldPathExpression
> > > > > > > > > > > > > > > > > > > > > #IdentificationVariable
> > > > > > > > > > > > > > > > > > > > > #StateField
> > > > > > > > > > > > > > > > > > > > > > #SimpleStateField
> > > > > > > > > > > > > > > > > > > > > > > #FieldIdentificationVariable
> > > > > > > > > > > > > > > > > > > #StringPrimary
> > > > > > > > > > > > > > > > > > > > #StateFieldPathExpression
> > > > > > > > > > > > > > > > > > > > > #IdentificationVariable
> > > > > > > > > > > > > > > > > > > > > #StateField
> > > > > > > > > > > > > > > > > > > > > > #SimpleStateField
> > > > > > > > > > > > > > > > > > > > > > > #FieldIdentificationVariable
> > > > > > > > > > > > #ScalarExpression
> > > > > > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > > > > > #SingleValuedPathExpression
> > > > > > > > > > > > > > > > > > #StateFieldPathExpression
> > > > > > > > > > > > > > > > > > > #IdentificationVariable
> > > > > > > > > > > > > > > > > > > #StateField
> > > > > > > > > > > > > > > > > > > > #SimpleStateField
> > > > > > > > > > > > > > > > > > > > > #FieldIdentificationVariable
> > > > > #AliasResultVariable
> > > #FromClause
> > > > #IdentificationVariableDeclaration
> > > > > #RangeVariableDeclaration
> > > > > > #AbstractSchemaName
> > > > > > #AliasIdentificationVariable
DQL:
SELECT DISTINCT emp FROM Doctrine\Tests\Models\CMS\CmsEmployee emp
WHERE EXISTS (
SELECT spouseEmp
FROM Doctrine\Tests\Models\CMS\CmsEmployee spouseEmp
WHERE spouseEmp = emp.spouse)
HOA AST:
> #QueryLanguage
> > #SelectStatement
> > > #SelectClause
> > > > #SelectExpression
> > > > > #IdentificationVariable
> > > #FromClause
> > > > #IdentificationVariableDeclaration
> > > > > #RangeVariableDeclaration
> > > > > > #AbstractSchemaName
> > > > > > #AliasIdentificationVariable
> > > #WhereClause
> > > > #ConditionalExpression
> > > > > #ConditionalTerm
> > > > > > #ConditionalFactor
> > > > > > > #ConditionalPrimary
> > > > > > > > #SimpleConditionalExpression
> > > > > > > > > #ExistsExpression
> > > > > > > > > > #Subselect
> > > > > > > > > > > #SimpleSelectClause
> > > > > > > > > > > > #SimpleSelectExpression
> > > > > > > > > > > > > #IdentificationVariable
> > > > > > > > > > > #SubselectFromClause
> > > > > > > > > > > > #SubselectIdentificationVariableDeclaration
> > > > > > > > > > > > > #IdentificationVariableDeclaration
> > > > > > > > > > > > > > #RangeVariableDeclaration
> > > > > > > > > > > > > > > #AbstractSchemaName
> > > > > > > > > > > > > > > #AliasIdentificationVariable
> > > > > > > > > > > #WhereClause
> > > > > > > > > > > > #ConditionalExpression
> > > > > > > > > > > > > #ConditionalTerm
> > > > > > > > > > > > > > #ConditionalFactor
> > > > > > > > > > > > > > > #ConditionalPrimary
> > > > > > > > > > > > > > > > #SimpleConditionalExpression
> > > > > > > > > > > > > > > > > #ComparisonExpression
> > > > > > > > > > > > > > > > > > #ArithmeticExpression
> > > > > > > > > > > > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > > > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > > > > > > > > > > > #IdentificationVariable
> > > > > > > > > > > > > > > > > > #ComparisonOperator
> > > > > > > > > > > > > > > > > > #ArithmeticExpression
> > > > > > > > > > > > > > > > > > > #SimpleArithmeticExpression
> > > > > > > > > > > > > > > > > > > > #ArithmeticTerm
> > > > > > > > > > > > > > > > > > > > > #ArithmeticFactor
> > > > > > > > > > > > > > > > > > > > > > #ArithmeticPrimary
> > > > > > > > > > > > > > > > > > > > > > > #SingleValuedPathExpression
> > > > > > > > > > > > > > > > > > > > > > > > #StateFieldPathExpression
> > > > > > > > > > > > > > > > > > > > > > > > > #IdentificationVariable
> > > > > > > > > > > > > > > > > > > > > > > > > #StateField
> > > > > > > > > > > > > > > > > > > > > > > > > > #SimpleStateField
> > > > > > > > > > > > > > > > > > > > > > > > > > > #FieldIdentificationVariable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment