diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2019-12-10 17:09:32 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2019-12-10 17:12:56 -0300 |
commit | 6cafde1bd43f1c28b044953cac2f2999eb425b22 (patch) | |
tree | f08bc9618832f34f0a26192ab04014d7300e43d8 /src/include/mb/stringinfo_mb.h | |
parent | 0da33c762b85aeada111aa1371c33ac6737f8396 (diff) |
Add backend-only appendStringInfoStringQuoted
This provides a mechanism to emit literal values in informative
messages, such as query parameters. The new code is more complex than
what it replaces, primarily because it wants to be more efficient.
It also has the (currently unused) additional optional capability of
specifying a maximum size to print.
The new function lives out of common/stringinfo.c so that frontend users
of that file need not pull in unnecessary multibyte-encoding support
code.
Author: Álvaro Herrera and Alexey Bashtanov, after a suggestion from Andres Freund
Reviewed-by: Tom Lane
Discussion: https://postgr.es/m/20190920203905.xkv5udsd5dxfs6tr@alap3.anarazel.de
Diffstat (limited to 'src/include/mb/stringinfo_mb.h')
-rw-r--r-- | src/include/mb/stringinfo_mb.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/include/mb/stringinfo_mb.h b/src/include/mb/stringinfo_mb.h new file mode 100644 index 00000000000..e90ba8bc511 --- /dev/null +++ b/src/include/mb/stringinfo_mb.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * stringinfo_mb.h + * multibyte support for StringInfo + * + * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/mb/stringinfo_mb.h + *------------------------------------------------------------------------- + */ +#ifndef STRINGINFO_MB_H +#define STRINGINFO_MB_H + + +#include "lib/stringinfo.h" + +/* + * Multibyte-aware StringInfo support function. + */ +extern void appendStringInfoStringQuoted(StringInfo str, + const char *s, int maxlen); + +#endif /* STRINGINFO_MB_H */ |