MCPcopy Create free account
hub / github.com/apecloud/myduckserver / ParseCopyFrom

Function ParseCopyFrom

pgserver/copy.go:65–76  ·  view source on GitHub ↗

ParseCopyFrom parses a COPY FROM statement and returns the query, format, and options.

(stmt string)

Source from the content-addressed store, hash-verified

63
64// ParseCopyFrom parses a COPY FROM statement and returns the query, format, and options.
65func ParseCopyFrom(stmt string) (target string, format tree.CopyFormat, options string, ok bool) {
66 stmt = RemoveComments(stmt)
67 stmt = sql.RemoveSpaceAndDelimiter(stmt, ';')
68 m := reCopyFromFormat.FindStringSubmatch(stmt)
69 if m == nil {
70 return "", 0, "", false
71 }
72 target = strings.TrimSpace(m[1])
73 format, ok = ParseFormat(strings.TrimSpace(m[2]))
74 options = strings.TrimSpace(m[3])
75 return
76}
77
78type OptionValueType uint8
79

Callers 1

Calls 2

RemoveCommentsFunction · 0.85
ParseFormatFunction · 0.85

Tested by

no test coverage detected