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

Function writeSuffixSelectClause

backend/plugin/parser/tidb/backup.go:708–716  ·  view source on GitHub ↗

writeSuffixSelectClause writes the " WHERE ... ORDER BY ... LIMIT ..." suffix of a DML statement, sliced from the original SQL via the node's Loc.

(buf *strings.Builder, node ast.Node, fullSQL string)

Source from the content-addressed store, hash-verified

706// writeSuffixSelectClause writes the "<table refs> WHERE ... ORDER BY ... LIMIT ..."
707// suffix of a DML statement, sliced from the original SQL via the node's Loc.
708func writeSuffixSelectClause(buf *strings.Builder, node ast.Node, fullSQL string) error {
709 switch n := node.(type) {
710 case *ast.UpdateStmt:
711 return writeUpdateSuffix(buf, n, fullSQL)
712 case *ast.DeleteStmt:
713 return writeDeleteSuffix(buf, n, fullSQL)
714 }
715 return nil
716}
717
718func writeUpdateSuffix(buf *strings.Builder, n *ast.UpdateStmt, sql string) error {
719 // "table_refs": from the first table ref to the last table ref's end.

Callers 2

generateSQLForMixedDMLFunction · 0.70

Calls 2

writeUpdateSuffixFunction · 0.70
writeDeleteSuffixFunction · 0.70

Tested by

no test coverage detected