(buf *strings.Builder, node oracleast.StmtNode, fullSQL string)
| 276 | } |
| 277 | |
| 278 | func writeSuffixSelectClause(buf *strings.Builder, node oracleast.StmtNode, fullSQL string) error { |
| 279 | suffix := "" |
| 280 | switch n := node.(type) { |
| 281 | case *oracleast.UpdateStmt: |
| 282 | suffix = oracleDMLTargetText(fullSQL, n.Table, n.PartitionExt, n.Alias) |
| 283 | if n.WhereClause != nil && n.SetClauses != nil && n.SetClauses.Len() > 0 { |
| 284 | if setClause, ok := n.SetClauses.Items[n.SetClauses.Len()-1].(*oracleast.SetClause); ok { |
| 285 | whereStart := setClause.Loc.End |
| 286 | if fromText, fromEnd, ok := oracleListText(fullSQL, n.FromClause); ok { |
| 287 | suffix += ", " + fromText |
| 288 | whereStart = fromEnd |
| 289 | } |
| 290 | suffix = joinOracleSuffix(suffix, oracleWhereSuffix(fullSQL, whereStart, n.WhereClause)) |
| 291 | } |
| 292 | } |
| 293 | case *oracleast.DeleteStmt: |
| 294 | targetEnd := n.Table.Loc.End |
| 295 | if n.PartitionExt != nil { |
| 296 | targetEnd = n.PartitionExt.Loc.End |
| 297 | } |
| 298 | if n.Alias != nil { |
| 299 | targetEnd = n.Alias.Loc.End |
| 300 | } |
| 301 | suffix = joinOracleSuffix(oracleDMLTargetText(fullSQL, n.Table, n.PartitionExt, n.Alias), oracleWhereSuffix(fullSQL, targetEnd, n.WhereClause)) |
| 302 | default: |
| 303 | } |
| 304 | _, err := buf.WriteString(suffix) |
| 305 | return err |
| 306 | } |
| 307 | |
| 308 | func oracleDMLTargetText(sql string, name *oracleast.ObjectName, partitionExt *oracleast.PartitionExtClause, alias *oracleast.Alias) string { |
| 309 | if name == nil { |
no test coverage detected