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

Function ParseCopyTo

pgserver/copy.go:51–62  ·  view source on GitHub ↗

ParseCopyTo parses a COPY TO statement and returns the query, format, and options.

(stmt string)

Source from the content-addressed store, hash-verified

49
50// ParseCopyTo parses a COPY TO statement and returns the query, format, and options.
51func ParseCopyTo(stmt string) (query string, format tree.CopyFormat, options string, ok bool) {
52 stmt = RemoveComments(stmt)
53 stmt = sql.RemoveSpaceAndDelimiter(stmt, ';')
54 m := reCopyToFormat.FindStringSubmatch(stmt)
55 if m == nil {
56 return "", 0, "", false
57 }
58 query = strings.TrimSpace(m[1])
59 format, ok = ParseFormat(strings.TrimSpace(m[2]))
60 options = strings.TrimSpace(m[3])
61 return
62}
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) {

Callers 1

Calls 2

RemoveCommentsFunction · 0.85
ParseFormatFunction · 0.85

Tested by

no test coverage detected