SQM 'insert select', 'insert values', and 'update' queries

This commit is contained in:
Steve Ebersole 2020-03-19 13:01:35 -05:00
parent 02cd346d3f
commit b3254a2fa6
2 changed files with 10 additions and 10 deletions

View File

@ -35,16 +35,16 @@ subQuery
: querySpec
;
rootEntity
dmlTarget
: entityName identificationVariableDef?
;
deleteStatement
: DELETE FROM? rootEntity whereClause?
: DELETE FROM? dmlTarget whereClause?
;
updateStatement
: UPDATE rootEntity setClause whereClause?
: UPDATE dmlTarget setClause whereClause?
;
setClause
@ -56,7 +56,7 @@ assignment
;
insertStatement
: INSERT INTO? rootEntity targetFieldsSpec (querySpec | valuesList)
: INSERT INTO? dmlTarget targetFieldsSpec (querySpec | valuesList)
;
targetFieldsSpec

View File

@ -309,8 +309,8 @@ public class SemanticQueryBuilder extends HqlParserBaseVisitor implements SqmCre
public SqmInsertStatement visitInsertStatement(HqlParser.InsertStatementContext ctx) {
final SqmRoot<?> root = new SqmRoot<>(
visitEntityName( ctx.rootEntity().entityName() ),
visitIdentificationVariableDef( ctx.rootEntity().identificationVariableDef() ),
visitEntityName( ctx.dmlTarget().entityName() ),
visitIdentificationVariableDef( ctx.dmlTarget().identificationVariableDef() ),
creationContext.getNodeBuilder()
);
@ -379,8 +379,8 @@ public class SemanticQueryBuilder extends HqlParserBaseVisitor implements SqmCre
@Override
public SqmUpdateStatement visitUpdateStatement(HqlParser.UpdateStatementContext ctx) {
final SqmRoot<?> root = new SqmRoot<>(
visitEntityName( ctx.rootEntity().entityName() ),
visitIdentificationVariableDef( ctx.rootEntity().identificationVariableDef() ),
visitEntityName( ctx.dmlTarget().entityName() ),
visitIdentificationVariableDef( ctx.dmlTarget().identificationVariableDef() ),
creationContext.getNodeBuilder()
);
@ -413,8 +413,8 @@ public class SemanticQueryBuilder extends HqlParserBaseVisitor implements SqmCre
@Override
public SqmDeleteStatement visitDeleteStatement(HqlParser.DeleteStatementContext ctx) {
final SqmRoot<?> root = new SqmRoot<>(
visitEntityName( ctx.rootEntity().entityName() ),
visitIdentificationVariableDef( ctx.rootEntity().identificationVariableDef() ),
visitEntityName( ctx.dmlTarget().entityName() ),
visitIdentificationVariableDef( ctx.dmlTarget().identificationVariableDef() ),
creationContext.getNodeBuilder()
);