ParseCopyTo parses a COPY TO statement and returns the query, format, and options.
(stmt string)
| 49 | |
| 50 | // ParseCopyTo parses a COPY TO statement and returns the query, format, and options. |
| 51 | func 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. |
| 65 | func ParseCopyFrom(stmt string) (target string, format tree.CopyFormat, options string, ok bool) { |
no test coverage detected