Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

refactor: using GetSymbol().GetTokenIndex() to keep consistency (#15268)

h3n4l7384ed1ffe09
diff --git a/backend/plugin/db/mssql/query.go b/backend/plugin/db/mssql/query.go
index 94e12070cd..964a2d64ba 100644
--- a/backend/plugin/db/mssql/query.go
+++ b/backend/plugin/db/mssql/query.go
@@ -297,7 +297,7 @@ func (r *tsqlRewriter) handleSqlunion(ctx tsql.IQuery_expressionContext) {
r.rewriter.InsertAfterDefault(querySpecification.GetAllOrDistinct().GetTokenIndex(), fmt.Sprintf(" TOP %d", r.limitCount))
return
}
- r.rewriter.InsertAfterDefault(querySpecification.SELECT().GetSourceInterval().Stop, fmt.Sprintf(" TOP %d", r.limitCount))
+ r.rewriter.InsertAfterDefault(querySpecification.SELECT().GetSymbol().GetTokenIndex(), fmt.Sprintf(" TOP %d", r.limitCount))
// handle union right side
querySpecification = ctx.Get_sql_union().Query_specification()
@@ -306,7 +306,7 @@ func (r *tsqlRewriter) handleSqlunion(ctx tsql.IQuery_expressionContext) {
r.rewriter.InsertAfterDefault(querySpecification.GetAllOrDistinct().GetTokenIndex(), fmt.Sprintf(" TOP %d", r.limitCount))
return
}
- r.rewriter.InsertAfterDefault(querySpecification.SELECT().GetSourceInterval().Stop, fmt.Sprintf(" TOP %d", r.limitCount))
+ r.rewriter.InsertAfterDefault(querySpecification.SELECT().GetSymbol().GetTokenIndex(), fmt.Sprintf(" TOP %d", r.limitCount))
}
func (r *tsqlRewriter) handleQuerySpecification(ctx tsql.IQuery_specificationContext) {
@@ -327,7 +327,7 @@ func (r *tsqlRewriter) handleQuerySpecification(ctx tsql.IQuery_specificationCon
return
}
// append after select keyword.
- r.rewriter.InsertAfterDefault(ctx.SELECT().GetSourceInterval().Stop, fmt.Sprintf(" TOP %d", r.limitCount))
+ r.rewriter.InsertAfterDefault(ctx.SELECT().GetSymbol().GetTokenIndex(), fmt.Sprintf(" TOP %d", r.limitCount))
r.hasTop = true
}