MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / Format

Method Format

pkg/sql/sem/plpgsqltree/statements.go:1266–1294  ·  view source on GitHub ↗
(ctx *tree.FmtCtx)

Source from the content-addressed store, hash-verified

1264}
1265
1266func (s *Fetch) Format(ctx *tree.FmtCtx) {
1267 ctx.WithAnnotations(s.Annotations, func() {
1268 if s.IsMove {
1269 ctx.WriteString("MOVE ")
1270 } else {
1271 ctx.WriteString("FETCH ")
1272 }
1273 if dir := s.Cursor.FetchType.String(); dir != "" {
1274 ctx.WriteString(dir)
1275 ctx.WriteString(" ")
1276 }
1277 if s.Cursor.FetchType.HasCount() {
1278 ctx.WriteString(strconv.Itoa(int(s.Cursor.Count)))
1279 ctx.WriteString(" ")
1280 }
1281 ctx.WriteString("FROM ")
1282 ctx.FormatName(string(s.Cursor.Name))
1283 if s.Target != nil {
1284 ctx.WriteString(" INTO ")
1285 for i := range s.Target {
1286 if i > 0 {
1287 ctx.WriteString(", ")
1288 }
1289 ctx.FormatNode(&s.Target[i])
1290 }
1291 }
1292 ctx.WriteString(";\n")
1293 })
1294}
1295
1296func (s *Fetch) PlpgSQLStatementTag() string {
1297 if s.IsMove {

Callers

nothing calls this directly

Calls 5

WithAnnotationsMethod · 0.80
HasCountMethod · 0.80
FormatNameMethod · 0.80
FormatNodeMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected