| 1 | /*------------------------------------------------------------------------- |
| 2 | * |
| 3 | * copy.h |
| 4 | * Definitions for using the POSTGRES copy command. |
| 5 | * |
| 6 | * |
| 7 | * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group |
| 8 | * Portions Copyright (c) 1994, Regents of the University of California |
| 9 | * |
| 10 | * src/include/commands/copy.h |
| 11 | * |
| 12 | *------------------------------------------------------------------------- |
| 13 | */ |
| 14 | #ifndef COPY_H |
| 15 | #define COPY_H |
| 16 | |
| 17 | #include "nodes/execnodes.h" |
| 18 | #include "nodes/parsenodes.h" |
| 19 | #include "parser/parse_node.h" |
| 20 | #include "tcop/dest.h" |
| 21 | |
| 22 | /* CopyStateData is private in commands/copy.c */ |
| 23 | typedef struct CopyStateData *CopyState; |
| 24 | typedef int (*copy_data_source_cb) (void *outbuf, int minread, int maxread); |
| 25 | |
| 26 | extern void DoCopy(ParseState *state, const CopyStmt *stmt, |
| 27 | int stmt_location, int stmt_len, |
| 28 | uint64 *processed); |
| 29 | |
| 30 | extern void ProcessCopyOptions(ParseState *pstate, CopyState cstate, bool is_from, List *options); |
| 31 | extern CopyState BeginCopyFrom(ParseState *pstate, Relation rel, const char *filename, |
| 32 | bool is_program, copy_data_source_cb data_source_cb, List *attnamelist, List *options); |
| 33 | extern void EndCopyFrom(CopyState cstate); |
| 34 | extern bool NextCopyFrom(CopyState cstate, ExprContext *econtext, |
| 35 | Datum *values, bool *nulls); |
| 36 | extern bool NextCopyFromRawFields(CopyState cstate, |
| 37 | char ***fields, int *nfields); |
| 38 | extern void CopyFromErrorCallback(void *arg); |
| 39 | |
| 40 | extern uint64 CopyFrom(CopyState cstate); |
| 41 | |
| 42 | extern DestReceiver *CreateCopyDestReceiver(void); |
| 43 | |
| 44 | #endif /* COPY_H */ |
| 45 | |