(node ast.Node, source string)
| 170 | } |
| 171 | |
| 172 | func 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 | |
| 191 | func prepareTransformation(databaseName, statement string) ([]statementInfo, error) { |
| 192 | parsedStatements, err := parseTSQLStatements(statement) |
no test coverage detected