MCPcopy Index your code
hub / github.com/bytebase/bytebase / writeSuffixSelectClause

Function writeSuffixSelectClause

backend/plugin/parser/plsql/backup.go:278–306  ·  view source on GitHub ↗
(buf *strings.Builder, node oracleast.StmtNode, fullSQL string)

Source from the content-addressed store, hash-verified

276}
277
278func 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
308func oracleDMLTargetText(sql string, name *oracleast.ObjectName, partitionExt *oracleast.PartitionExtClause, alias *oracleast.Alias) string {
309 if name == nil {

Callers 1

generateSQLForTableFunction · 0.70

Calls 5

oracleDMLTargetTextFunction · 0.85
oracleListTextFunction · 0.85
joinOracleSuffixFunction · 0.85
oracleWhereSuffixFunction · 0.85
LenMethod · 0.80

Tested by

no test coverage detected