2000-01-19 00:30:24 +01:00
|
|
|
/*
|
|
|
|
* psql - the PostgreSQL interactive terminal
|
|
|
|
*
|
2017-01-03 19:48:53 +01:00
|
|
|
* Copyright (c) 2000-2017, PostgreSQL Global Development Group
|
2000-01-19 00:30:24 +01:00
|
|
|
*
|
2010-09-20 22:08:53 +02:00
|
|
|
* src/bin/psql/stringutils.h
|
2000-01-19 00:30:24 +01:00
|
|
|
*/
|
1996-07-09 08:22:35 +02:00
|
|
|
#ifndef STRINGUTILS_H
|
|
|
|
#define STRINGUTILS_H
|
|
|
|
|
1999-11-04 22:56:02 +01:00
|
|
|
/* The cooler version of strtok() which knows about quotes and doesn't
|
|
|
|
* overwrite your input */
|
1999-11-05 00:14:30 +01:00
|
|
|
extern char *strtokx(const char *s,
|
2002-10-19 02:22:14 +02:00
|
|
|
const char *whitespace,
|
1999-11-05 00:14:30 +01:00
|
|
|
const char *delim,
|
|
|
|
const char *quote,
|
2002-10-19 02:22:14 +02:00
|
|
|
char escape,
|
2006-06-01 03:28:00 +02:00
|
|
|
bool e_strings,
|
2002-10-19 02:22:14 +02:00
|
|
|
bool del_quotes,
|
2000-01-15 06:38:50 +01:00
|
|
|
int encoding);
|
2001-10-28 07:26:15 +01:00
|
|
|
|
Add support for piping COPY to/from an external program.
This includes backend "COPY TO/FROM PROGRAM '...'" syntax, and corresponding
psql \copy syntax. Like with reading/writing files, the backend version is
superuser-only, and in the psql version, the program is run in the client.
In the passing, the psql \copy STDIN/STDOUT syntax is subtly changed: if you
the stdin/stdout is quoted, it's now interpreted as a filename. For example,
"\copy foo from 'stdin'" now reads from a file called 'stdin', not from
standard input. Before this, there was no way to specify a filename called
stdin, stdout, pstdin or pstdout.
This creates a new function in pgport, wait_result_to_str(), which can
be used to convert the exit status of a process, as returned by wait(3),
to a human-readable string.
Etsuro Fujita, reviewed by Amit Kapila.
2013-02-27 17:17:21 +01:00
|
|
|
extern void strip_quotes(char *source, char quote, char escape, int encoding);
|
|
|
|
|
2012-02-28 05:06:29 +01:00
|
|
|
extern char *quote_if_needed(const char *source, const char *entails_quote,
|
|
|
|
char quote, char escape, int encoding);
|
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* STRINGUTILS_H */
|