ParseCopyFrom parses a COPY FROM statement and returns the query, format, and options.
(stmt string)
| 63 | |
| 64 | // ParseCopyFrom parses a COPY FROM statement and returns the query, format, and options. |
| 65 | func 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 | |
| 78 | type OptionValueType uint8 |
| 79 |
no test coverage detected