MCPcopy Create free account
hub / github.com/bytebase/bytebase / extractSuffixSelectStatement

Function extractSuffixSelectStatement

backend/plugin/parser/tsql/backup.go:172–189  ·  view source on GitHub ↗
(node ast.Node, source string)

Source from the content-addressed store, hash-verified

170}
171
172func extractSuffixSelectStatement(node ast.Node, source string) (string, string, error) {
173 switch n := node.(type) {
174 case *ast.UpdateStmt:
175 if _, ok := n.WhereClause.(*ast.CurrentOfExpr); ok {
176 return "", "", errors.New("UPDATE statement with CURSOR clause is not supported")
177 }
178 fromSource, searchStart := dmlFromSource(source, n.Relation, n.FromClause, dmlNodeLoc(n), n.WhereClause, n.OptionClause)
179 return sourceFromLoc(source, dmlNodeLoc(n.Top)), buildDMLFromClause(source, fromSource, searchStart, dmlNodeLoc(n), n.WhereClause, n.OptionClause), nil
180 case *ast.DeleteStmt:
181 if _, ok := n.WhereClause.(*ast.CurrentOfExpr); ok {
182 return "", "", errors.New("DELETE statement with CURSOR clause is not supported")
183 }
184 fromSource, searchStart := dmlFromSource(source, n.Relation, n.FromClause, dmlNodeLoc(n), n.WhereClause, n.OptionClause)
185 return sourceFromLoc(source, dmlNodeLoc(n.Top)), buildDMLFromClause(source, fromSource, searchStart, dmlNodeLoc(n), n.WhereClause, n.OptionClause), nil
186 default:
187 return "", "", nil
188 }
189}
190
191func prepareTransformation(databaseName, statement string) ([]statementInfo, error) {
192 parsedStatements, err := parseTSQLStatements(statement)

Callers 1

generateSQLForTableFunction · 0.85

Calls 4

dmlFromSourceFunction · 0.85
dmlNodeLocFunction · 0.85
sourceFromLocFunction · 0.85
buildDMLFromClauseFunction · 0.85

Tested by

no test coverage detected