PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/xact.h"
#include "catalog/namespace.h"
#include "mb/pg_wchar.h"
#include "utils/fmgrprotos.h"
#include "utils/memutils.h"
#include "varatt.h"
Go to the source code of this file.
Data Structures | |
struct | ConvProcInfo |
Typedefs | |
typedef struct ConvProcInfo | ConvProcInfo |
Functions | |
static char * | perform_default_encoding_conversion (const char *src, int len, bool is_client_to_server) |
static int | cliplen (const char *str, int len, int limit) |
int | PrepareClientEncoding (int encoding) |
int | SetClientEncoding (int encoding) |
void | InitializeClientEncoding (void) |
int | pg_get_client_encoding (void) |
const char * | pg_get_client_encoding_name (void) |
unsigned char * | pg_do_encoding_conversion (unsigned char *src, int len, int src_encoding, int dest_encoding) |
int | pg_do_encoding_conversion_buf (Oid proc, int src_encoding, int dest_encoding, unsigned char *src, int srclen, unsigned char *dest, int destlen, bool noError) |
Datum | pg_convert_to (PG_FUNCTION_ARGS) |
Datum | pg_convert_from (PG_FUNCTION_ARGS) |
Datum | pg_convert (PG_FUNCTION_ARGS) |
Datum | length_in_encoding (PG_FUNCTION_ARGS) |
Datum | pg_encoding_max_length_sql (PG_FUNCTION_ARGS) |
char * | pg_client_to_server (const char *s, int len) |
char * | pg_any_to_server (const char *s, int len, int encoding) |
char * | pg_server_to_client (const char *s, int len) |
char * | pg_server_to_any (const char *s, int len, int encoding) |
void | pg_unicode_to_server (pg_wchar c, unsigned char *s) |
bool | pg_unicode_to_server_noerror (pg_wchar c, unsigned char *s) |
int | pg_mb2wchar (const char *from, pg_wchar *to) |
int | pg_mb2wchar_with_len (const char *from, pg_wchar *to, int len) |
int | pg_encoding_mb2wchar_with_len (int encoding, const char *from, pg_wchar *to, int len) |
int | pg_wchar2mb (const pg_wchar *from, char *to) |
int | pg_wchar2mb_with_len (const pg_wchar *from, char *to, int len) |
int | pg_encoding_wchar2mb_with_len (int encoding, const pg_wchar *from, char *to, int len) |
int | pg_mblen (const char *mbstr) |
int | pg_dsplen (const char *mbstr) |
int | pg_mbstrlen (const char *mbstr) |
int | pg_mbstrlen_with_len (const char *mbstr, int limit) |
int | pg_mbcliplen (const char *mbstr, int len, int limit) |
int | pg_encoding_mbcliplen (int encoding, const char *mbstr, int len, int limit) |
int | pg_mbcharcliplen (const char *mbstr, int len, int limit) |
void | SetDatabaseEncoding (int encoding) |
void | SetMessageEncoding (int encoding) |
int | GetDatabaseEncoding (void) |
const char * | GetDatabaseEncodingName (void) |
Datum | getdatabaseencoding (PG_FUNCTION_ARGS) |
Datum | pg_client_encoding (PG_FUNCTION_ARGS) |
Datum | PG_char_to_encoding (PG_FUNCTION_ARGS) |
Datum | PG_encoding_to_char (PG_FUNCTION_ARGS) |
int | GetMessageEncoding (void) |
static bool | pg_generic_charinc (unsigned char *charptr, int len) |
static bool | pg_utf8_increment (unsigned char *charptr, int length) |
static bool | pg_eucjp_increment (unsigned char *charptr, int length) |
mbcharacter_incrementer | pg_database_encoding_character_incrementer (void) |
int | pg_database_encoding_max_length (void) |
bool | pg_verifymbstr (const char *mbstr, int len, bool noError) |
bool | pg_verify_mbstr (int encoding, const char *mbstr, int len, bool noError) |
int | pg_verify_mbstr_len (int encoding, const char *mbstr, int len, bool noError) |
void | check_encoding_conversion_args (int src_encoding, int dest_encoding, int len, int expected_src_encoding, int expected_dest_encoding) |
void | report_invalid_encoding (int encoding, const char *mbstr, int len) |
void | report_untranslatable_char (int src_encoding, int dest_encoding, const char *mbstr, int len) |
Variables | |
static List * | ConvProcList = NIL |
static FmgrInfo * | ToServerConvProc = NULL |
static FmgrInfo * | ToClientConvProc = NULL |
static FmgrInfo * | Utf8ToServerConvProc = NULL |
static const pg_enc2name * | ClientEncoding = &pg_enc2name_tbl[PG_SQL_ASCII] |
static const pg_enc2name * | DatabaseEncoding = &pg_enc2name_tbl[PG_SQL_ASCII] |
static const pg_enc2name * | MessageEncoding = &pg_enc2name_tbl[PG_SQL_ASCII] |
static bool | backend_startup_complete = false |
static int | pending_client_encoding = PG_SQL_ASCII |
typedef struct ConvProcInfo ConvProcInfo |
void check_encoding_conversion_args | ( | int | src_encoding, |
int | dest_encoding, | ||
int | len, | ||
int | expected_src_encoding, | ||
int | expected_dest_encoding | ||
) |
Definition at line 1669 of file mbutils.c.
References elog, ERROR, len, name, pg_enc2name_tbl, and PG_VALID_ENCODING.
|
static |
Definition at line 1150 of file mbutils.c.
Referenced by pg_encoding_mbcliplen(), pg_mbcharcliplen(), and pgstat_clip_activity().
Datum getdatabaseencoding | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1273 of file mbutils.c.
References CStringGetDatum(), DatabaseEncoding, DirectFunctionCall1, pg_enc2name::name, and namein().
int GetDatabaseEncoding | ( | void | ) |
Definition at line 1261 of file mbutils.c.
References DatabaseEncoding, and pg_enc2name::encoding.
Referenced by ascii(), BeginCopyFrom(), BeginCopyTo(), char2wchar(), chr(), CollationCreate(), CollationGetCollid(), compareStrings(), convert_from_utf8(), convert_to_utf8(), CopyConversionError(), CopyConvertBuf(), create_pg_locale(), cstr2sv(), dblink_connect(), dblink_get_conn(), DefineCollation(), Generic_Text_IC_like(), GenericMatchText(), get_collation_oid(), get_json_object_as_hash(), InitializeClientEncoding(), IsThereCollationInNamespace(), json_recv(), jsonb_from_cstring(), locate_stem_module(), LogicalOutputWrite(), makeJsonLexContext(), p_isspecial(), ParallelWorkerMain(), pg_database_encoding_character_incrementer(), pg_database_encoding_max_length(), pg_generic_charinc(), pg_perm_setlocale(), pg_set_regex_collation(), pg_unicode_to_server(), pg_unicode_to_server_noerror(), pg_verifymbstr(), pgss_store(), PLyUnicode_Bytes(), populate_array_json(), PrepareClientEncoding(), read_extension_script_file(), SetClientEncoding(), str_initcap(), str_tolower(), str_toupper(), strncoll_libc(), sv2cstr(), text_position_setup(), to_ascii_default(), type_maximum_size(), unicode_assigned(), unicode_norm_form_from_string(), wchar2char(), xml_in(), xml_is_document(), xmlparse(), and xmltotext_with_options().
const char* GetDatabaseEncodingName | ( | void | ) |
Definition at line 1267 of file mbutils.c.
References DatabaseEncoding, and pg_enc2name::name.
Referenced by check_client_encoding(), CheckMyDatabase(), connect_pg_server(), dblink_connect(), dblink_get_conn(), get_collation_oid(), InitializeClientEncoding(), IsThereCollationInNamespace(), json_errdetail(), libpqrcv_connect(), locate_stem_module(), pg_unicode_to_server(), ProcessConfigFileInternal(), and regcollationin().
int GetMessageEncoding | ( | void | ) |
void InitializeClientEncoding | ( | void | ) |
Definition at line 281 of file mbutils.c.
References Assert, backend_startup_complete, ereport, errcode(), errmsg(), FATAL, FindDefaultConversionProc(), fmgr_info_cxt(), GetDatabaseEncoding(), GetDatabaseEncodingName(), IsTransactionState(), MemoryContextAlloc(), name, OidIsValid, pending_client_encoding, pg_enc2name_tbl, PG_SQL_ASCII, PG_UTF8, PrepareClientEncoding(), SetClientEncoding(), TopMemoryContext, and Utf8ToServerConvProc.
Referenced by InitPostgres().
Datum length_in_encoding | ( | PG_FUNCTION_ARGS | ) |
Definition at line 615 of file mbutils.c.
References ereport, errcode(), errmsg(), ERROR, len, NameStr, pg_char_to_encoding, PG_GETARG_BYTEA_PP, PG_GETARG_NAME, PG_RETURN_INT32, pg_verify_mbstr_len(), VARDATA_ANY, and VARSIZE_ANY_EXHDR.
|
static |
Definition at line 783 of file mbutils.c.
References BoolGetDatum(), ClientEncoding, CStringGetDatum(), CurrentMemoryContext, DatabaseEncoding, pg_enc2name::encoding, ereport, errcode(), errdetail(), errmsg(), ERROR, FunctionCall6, Int32GetDatum(), len, MAX_CONVERSION_GROWTH, MaxAllocHugeSize, MaxAllocSize, MemoryContextAllocHuge(), repalloc(), ToClientConvProc, ToServerConvProc, and unconstify.
Referenced by pg_any_to_server(), and pg_server_to_any().
char* pg_any_to_server | ( | const char * | s, |
int | len, | ||
int | encoding | ||
) |
Definition at line 676 of file mbutils.c.
References ClientEncoding, DatabaseEncoding, encoding, pg_enc2name::encoding, ereport, errcode(), errmsg(), ERROR, i, IS_HIGHBIT_SET, len, name, perform_default_encoding_conversion(), pg_do_encoding_conversion(), pg_enc2name_tbl, PG_SQL_ASCII, PG_VALID_BE_ENCODING, pg_verify_mbstr(), and unconstify.
Referenced by ASN1_STRING_to_text(), cache_single_string(), db_encoding_convert(), dsnowball_lexize(), pg_client_to_server(), pg_stat_statements_internal(), pgp_armor_headers(), PLyUnicode_Bytes(), read_extension_script_file(), tsearch_readline(), utf_u2e(), X509_NAME_to_cstring(), and xml_recv().
Datum PG_char_to_encoding | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1285 of file mbutils.c.
References NameStr, pg_char_to_encoding, PG_GETARG_NAME, and PG_RETURN_INT32.
Datum pg_client_encoding | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1279 of file mbutils.c.
References ClientEncoding, CStringGetDatum(), DirectFunctionCall1, pg_enc2name::name, and namein().
char* pg_client_to_server | ( | const char * | s, |
int | len | ||
) |
Definition at line 660 of file mbutils.c.
References ClientEncoding, pg_enc2name::encoding, len, and pg_any_to_server().
Referenced by exec_bind_message(), parse_fcall_arguments(), pq_getmsgstring(), and pq_getmsgtext().
Datum pg_convert | ( | PG_FUNCTION_ARGS | ) |
Definition at line 553 of file mbutils.c.
References ereport, errcode(), errmsg(), ERROR, len, NameStr, palloc(), pfree(), pg_char_to_encoding, pg_do_encoding_conversion(), PG_FREE_IF_COPY, PG_GETARG_BYTEA_PP, PG_GETARG_NAME, PG_RETURN_BYTEA_P, pg_verify_mbstr(), SET_VARSIZE, unconstify, VARDATA, VARDATA_ANY, VARHDRSZ, and VARSIZE_ANY_EXHDR.
Referenced by pg_convert_from(), and pg_convert_to().
Datum pg_convert_from | ( | PG_FUNCTION_ARGS | ) |
Definition at line 526 of file mbutils.c.
References CStringGetDatum(), DatabaseEncoding, DirectFunctionCall1, DirectFunctionCall3, pg_enc2name::name, namein(), pg_convert(), PG_GETARG_DATUM, and PG_RETURN_DATUM.
Datum pg_convert_to | ( | PG_FUNCTION_ARGS | ) |
Definition at line 501 of file mbutils.c.
References CStringGetDatum(), DatabaseEncoding, DirectFunctionCall1, DirectFunctionCall3, pg_enc2name::name, namein(), pg_convert(), PG_GETARG_DATUM, and PG_RETURN_DATUM.
mbcharacter_incrementer pg_database_encoding_character_incrementer | ( | void | ) |
Definition at line 1523 of file mbutils.c.
References GetDatabaseEncoding(), PG_EUC_JP, pg_eucjp_increment(), pg_generic_charinc(), PG_UTF8, and pg_utf8_increment().
Referenced by make_greater_string().
int pg_database_encoding_max_length | ( | void | ) |
Definition at line 1546 of file mbutils.c.
References GetDatabaseEncoding(), pg_wchar_tbl::maxmblen, and pg_wchar_table.
Referenced by bpcharlen(), charlen_to_bytelen(), dotrim(), downcase_identifier(), gbt_bpchar_consistent(), gbt_text_compress(), gbt_text_consistent(), generate_trgm_only(), Generic_Text_IC_like(), GenericMatchText(), infix(), init_tsvector_parser(), like_escape(), like_fixed_prefix(), lowerstr_with_len(), lpad(), pg_mbcharcliplen(), pg_mbstrlen(), pg_mbstrlen_with_len(), protect_out_of_mem(), regexp_fixed_prefix(), rpad(), setup_regexp_matches(), setup_test_matches(), show_trgm(), str_initcap(), str_tolower(), str_toupper(), text_length(), text_position_setup(), text_reverse(), text_substring(), TParserInit(), translate(), and tsvectorout().
unsigned char* pg_do_encoding_conversion | ( | unsigned char * | src, |
int | len, | ||
int | src_encoding, | ||
int | dest_encoding | ||
) |
Definition at line 356 of file mbutils.c.
References BoolGetDatum(), CStringGetDatum(), CurrentMemoryContext, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, FindDefaultConversionProc(), Int32GetDatum(), IsTransactionState(), len, MAX_CONVERSION_GROWTH, MaxAllocHugeSize, MaxAllocSize, MemoryContextAllocHuge(), OidFunctionCall6, OidIsValid, pg_encoding_to_char, PG_SQL_ASCII, pg_verify_mbstr(), and repalloc().
Referenced by convert_charset(), pg_any_to_server(), pg_convert(), and pg_server_to_any().
int pg_do_encoding_conversion_buf | ( | Oid | proc, |
int | src_encoding, | ||
int | dest_encoding, | ||
unsigned char * | src, | ||
int | srclen, | ||
unsigned char * | dest, | ||
int | destlen, | ||
bool | noError | ||
) |
Definition at line 469 of file mbutils.c.
References BoolGetDatum(), CStringGetDatum(), DatumGetInt32(), generate_unaccent_rules::dest, Int32GetDatum(), MAX_CONVERSION_GROWTH, and OidFunctionCall6.
Referenced by CopyConversionError(), CopyConvertBuf(), and test_enc_conversion().
int pg_dsplen | ( | const char * | mbstr | ) |
Definition at line 1030 of file mbutils.c.
References DatabaseEncoding, pg_wchar_tbl::dsplen, pg_enc2name::encoding, and pg_wchar_table.
Referenced by p_isspecial().
Datum pg_encoding_max_length_sql | ( | PG_FUNCTION_ARGS | ) |
Definition at line 644 of file mbutils.c.
References encoding, PG_GETARG_INT32, PG_RETURN_INT32, PG_RETURN_NULL, PG_VALID_ENCODING, and pg_wchar_table.
int pg_encoding_mb2wchar_with_len | ( | int | encoding, |
const char * | from, | ||
pg_wchar * | to, | ||
int | len | ||
) |
Definition at line 993 of file mbutils.c.
References encoding, len, pg_wchar_tbl::mb2wchar_with_len, and pg_wchar_table.
int pg_encoding_mbcliplen | ( | int | encoding, |
const char * | mbstr, | ||
int | len, | ||
int | limit | ||
) |
Definition at line 1093 of file mbutils.c.
References cliplen(), encoding, len, pg_wchar_tbl::mblen, pg_encoding_max_length(), and pg_wchar_table.
Referenced by pg_mbcliplen().
Datum PG_encoding_to_char | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1293 of file mbutils.c.
References CStringGetDatum(), DirectFunctionCall1, encoding, namein(), pg_encoding_to_char, and PG_GETARG_INT32.
int pg_encoding_wchar2mb_with_len | ( | int | encoding, |
const pg_wchar * | from, | ||
char * | to, | ||
int | len | ||
) |
Definition at line 1015 of file mbutils.c.
References encoding, len, pg_wchar_table, and pg_wchar_tbl::wchar2mb_with_len.
|
static |
Definition at line 1437 of file mbutils.c.
References i, IS_HIGHBIT_SET, SS2, and SS3.
Referenced by pg_database_encoding_character_incrementer().
|
static |
Definition at line 1325 of file mbutils.c.
References GetDatabaseEncoding(), len, pg_wchar_tbl::mbverifychar, and pg_wchar_table.
Referenced by pg_database_encoding_character_incrementer().
int pg_get_client_encoding | ( | void | ) |
Definition at line 336 of file mbutils.c.
References ClientEncoding, and pg_enc2name::encoding.
Referenced by BeginCopyFrom(), BeginCopyTo(), and xml_send().
const char* pg_get_client_encoding_name | ( | void | ) |
Definition at line 345 of file mbutils.c.
References ClientEncoding, and pg_enc2name::name.
int pg_mb2wchar | ( | const char * | from, |
pg_wchar * | to | ||
) |
Definition at line 979 of file mbutils.c.
References DatabaseEncoding, pg_enc2name::encoding, pg_wchar_tbl::mb2wchar_with_len, and pg_wchar_table.
int pg_mb2wchar_with_len | ( | const char * | from, |
pg_wchar * | to, | ||
int | len | ||
) |
Definition at line 986 of file mbutils.c.
References DatabaseEncoding, pg_enc2name::encoding, len, pg_wchar_tbl::mb2wchar_with_len, and pg_wchar_table.
Referenced by CheckAffix(), NIAddAffix(), RE_compile(), RE_compile_and_cache(), RE_execute(), regcomp_auth_token(), regexec_auth_token(), replace_text_regexp(), setup_regexp_matches(), setup_test_matches(), test_re_compile(), and TParserInit().
int pg_mbcharcliplen | ( | const char * | mbstr, |
int | len, | ||
int | limit | ||
) |
Definition at line 1125 of file mbutils.c.
References cliplen(), len, pg_database_encoding_max_length(), and pg_mblen().
Referenced by bpchar(), bpchar_input(), text_left(), text_right(), varchar(), and varchar_input().
int pg_mbcliplen | ( | const char * | mbstr, |
int | len, | ||
int | limit | ||
) |
Definition at line 1083 of file mbutils.c.
References DatabaseEncoding, pg_enc2name::encoding, len, and pg_encoding_mbcliplen().
Referenced by appendStringInfoStringQuoted(), bpchar_name(), ChooseIndexColumnNames(), CopyLimitPrintoutLength(), ExecBuildSlotPartitionKeyDescription(), ExecBuildSlotValueDescription(), make_colname_unique(), make_greater_string(), makeMultirangeTypeName(), makeObjectName(), MemoryContextStatsPrint(), nameconcatoid(), namein(), pgstat_clip_activity(), pgstat_report_appname(), PutMemoryContextsStatsTupleStore(), set_rtable_names(), text_name(), text_to_cstring_buffer(), and truncate_identifier().
int pg_mblen | ( | const char * | mbstr | ) |
Definition at line 1023 of file mbutils.c.
References DatabaseEncoding, pg_enc2name::encoding, pg_wchar_tbl::mblen, and pg_wchar_table.
Referenced by addCompoundAffixFlagValue(), bit_in(), charlen_to_bytelen(), DCH_from_char(), dotrim(), find_word(), findchar(), findchar2(), findwrd(), gbt_var_node_cp_len(), get_modifiers(), get_nextfield(), get_wildcard_part(), getlexeme(), getNextFlagFromString(), gettoken_query(), gettoken_query_standard(), gettoken_query_websearch(), gettoken_tsvector(), hex_decode_safe(), infix(), initTrie(), lpad(), make_trigrams(), map_sql_identifier_to_xml_name(), map_xml_name_to_sql_identifier(), match_prosrc_to_literal(), mb_strchr(), NIImportAffixes(), NIImportDictionary(), NIImportOOAffixes(), NUM_eat_non_data_chars(), NUM_processor(), parse_affentry(), parse_format(), parse_lquery(), parse_ltree(), parse_or_operator(), parse_re_flags(), parse_test_flags(), pg_base64_decode(), pg_mbcharcliplen(), pg_mbstrlen(), pg_mbstrlen_with_len(), prssyntaxerror(), readstoplist(), report_json_context(), rpad(), RS_compile(), RS_execute(), RS_isRegis(), similar_escape_internal(), split_text(), t_isalnum(), t_isalpha(), t_isdigit(), t_isprint(), t_isspace(), text_format(), text_position_next(), text_reverse(), text_substring(), text_to_bits(), textregexreplace(), thesaurusRead(), TParserGet(), translate(), ts_stat_sql(), tsvectorout(), unaccent_lexize(), varbit_in(), varstr_levenshtein(), and wchareq().
int pg_mbstrlen | ( | const char * | mbstr | ) |
Definition at line 1037 of file mbutils.c.
References len, pg_database_encoding_max_length(), and pg_mblen().
Referenced by NUM_processor(), and text_format_append_string().
int pg_mbstrlen_with_len | ( | const char * | mbstr, |
int | limit | ||
) |
Definition at line 1057 of file mbutils.c.
References len, pg_database_encoding_max_length(), and pg_mblen().
Referenced by bpchar(), bpchar_input(), bpcharlen(), executor_errposition(), lpad(), match_prosrc_to_query(), parser_errposition(), plpgsql_scanner_errposition(), rpad(), similar_escape_internal(), text_left(), text_length(), text_position_get_match_pos(), text_right(), text_substring(), unicode_assigned(), unicode_is_normalized(), unicode_normalize_func(), and varstr_levenshtein().
char* pg_server_to_any | ( | const char * | s, |
int | len, | ||
int | encoding | ||
) |
Definition at line 749 of file mbutils.c.
References ClientEncoding, DatabaseEncoding, encoding, pg_enc2name::encoding, len, perform_default_encoding_conversion(), pg_do_encoding_conversion(), PG_SQL_ASCII, pg_verify_mbstr(), and unconstify.
Referenced by compareStrings(), CopyAttributeOutCSV(), CopyAttributeOutText(), daitch_mokotoff(), DoCopyTo(), dsnowball_lexize(), hv_fetch_string(), hv_store_string(), pg_server_to_client(), PLyUnicode_FromStringAndSize(), and utf_e2u().
char* pg_server_to_client | ( | const char * | s, |
int | len | ||
) |
Definition at line 738 of file mbutils.c.
References ClientEncoding, pg_enc2name::encoding, len, and pg_server_to_any().
Referenced by pq_puttextmessage(), pq_sendcountedtext(), pq_sendstring(), pq_sendtext(), and pq_writestring().
void pg_unicode_to_server | ( | pg_wchar | c, |
unsigned char * | s | ||
) |
Definition at line 864 of file mbutils.c.
References BoolGetDatum(), CStringGetDatum(), ereport, errcode(), errmsg(), ERROR, FunctionCall6, GetDatabaseEncoding(), GetDatabaseEncodingName(), Int32GetDatum(), is_valid_unicode_codepoint(), MAX_MULTIBYTE_CHAR_LEN, name, pg_enc2name_tbl, PG_UTF8, pg_utf_mblen, unicode_to_utf8(), and Utf8ToServerConvProc.
Referenced by map_xml_name_to_sql_identifier(), str_udeescape(), and unistr().
Definition at line 926 of file mbutils.c.
References BoolGetDatum(), CStringGetDatum(), DatumGetInt32(), FunctionCall6, GetDatabaseEncoding(), Int32GetDatum(), is_valid_unicode_codepoint(), MAX_MULTIBYTE_CHAR_LEN, PG_UTF8, pg_utf_mblen, unicode_to_utf8(), and Utf8ToServerConvProc.
Referenced by json_lex_string().
|
static |
Definition at line 1359 of file mbutils.c.
References a.
Referenced by pg_database_encoding_character_incrementer().
Definition at line 1566 of file mbutils.c.
References Assert, encoding, len, pg_wchar_tbl::mbverifystr, PG_VALID_ENCODING, pg_wchar_table, and report_invalid_encoding().
Referenced by AddFileToBackupManifest(), LogicalOutputWrite(), pg_any_to_server(), pg_convert(), pg_do_encoding_conversion(), pg_server_to_any(), pg_verifymbstr(), and read_extension_script_file().
int pg_verify_mbstr_len | ( | int | encoding, |
const char * | mbstr, | ||
int | len, | ||
bool | noError | ||
) |
Definition at line 1597 of file mbutils.c.
References Assert, encoding, IS_HIGHBIT_SET, len, pg_wchar_tbl::mbverifychar, pg_encoding_max_length(), PG_VALID_ENCODING, pg_wchar_table, and report_invalid_encoding().
Referenced by length_in_encoding().
Definition at line 1556 of file mbutils.c.
References GetDatabaseEncoding(), len, and pg_verify_mbstr().
Referenced by char2wchar(), CopyReadAttributesText(), plperl_spi_exec(), plperl_spi_prepare(), plperl_spi_query(), PLy_cursor_query(), PLy_output(), PLy_spi_execute_query(), PLy_spi_prepare(), PLyObject_AsString(), read_text_file(), and spg_text_leaf_consistent().
int pg_wchar2mb | ( | const pg_wchar * | from, |
char * | to | ||
) |
Definition at line 1001 of file mbutils.c.
References DatabaseEncoding, pg_enc2name::encoding, pg_wchar_strlen(), pg_wchar_table, and pg_wchar_tbl::wchar2mb_with_len.
int pg_wchar2mb_with_len | ( | const pg_wchar * | from, |
char * | to, | ||
int | len | ||
) |
Definition at line 1008 of file mbutils.c.
References DatabaseEncoding, pg_enc2name::encoding, len, pg_wchar_table, and pg_wchar_tbl::wchar2mb_with_len.
Referenced by build_regexp_match_result(), build_regexp_split_result(), build_test_match_result(), convertPgWchar(), and regexp_fixed_prefix().
int PrepareClientEncoding | ( | int | encoding | ) |
Definition at line 110 of file mbutils.c.
References backend_startup_complete, ConvProcInfo::c_encoding, ConvProcList, encoding, FindDefaultConversionProc(), fmgr_info_cxt(), GetDatabaseEncoding(), IsTransactionState(), lcons(), lfirst, MemoryContextAlloc(), MemoryContextSwitchTo(), OidIsValid, PG_SQL_ASCII, PG_VALID_FE_ENCODING, ConvProcInfo::s_encoding, ConvProcInfo::to_client_info, ConvProcInfo::to_server_info, and TopMemoryContext.
Referenced by check_client_encoding(), and InitializeClientEncoding().
void report_invalid_encoding | ( | int | encoding, |
const char * | mbstr, | ||
int | len | ||
) |
Definition at line 1698 of file mbutils.c.
References buf, encoding, ereport, errcode(), errmsg(), ERROR, j, len, Min, name, pg_enc2name_tbl, pg_encoding_mblen(), and sprintf.
Referenced by big52euc_tw(), big52mic(), CopyConversionError(), euc_cn2mic(), euc_jis_20042shift_jis_2004(), euc_jp2mic(), euc_jp2sjis(), euc_kr2mic(), euc_tw2big5(), euc_tw2mic(), iso8859_1_to_utf8(), latin2mic(), latin2mic_with_table(), local2local(), LocalToUtf(), mic2big5(), mic2euc_cn(), mic2euc_jp(), mic2euc_kr(), mic2euc_tw(), mic2latin(), mic2latin_with_table(), mic2sjis(), pg_verify_mbstr(), pg_verify_mbstr_len(), shift_jis_20042euc_jis_2004(), sjis2euc_jp(), sjis2mic(), test_enc_conversion(), utf8_to_iso8859_1(), and UtfToLocal().
void report_untranslatable_char | ( | int | src_encoding, |
int | dest_encoding, | ||
const char * | mbstr, | ||
int | len | ||
) |
Definition at line 1730 of file mbutils.c.
References buf, ereport, errcode(), errmsg(), ERROR, j, len, Min, name, pg_enc2name_tbl, pg_encoding_mblen(), and sprintf.
Referenced by big52euc_tw(), big52mic(), euc_tw2big5(), latin2mic_with_table(), local2local(), LocalToUtf(), mic2big5(), mic2euc_cn(), mic2euc_jp(), mic2euc_kr(), mic2euc_tw(), mic2latin(), mic2latin_with_table(), mic2sjis(), utf8_to_iso8859_1(), and UtfToLocal().
int SetClientEncoding | ( | int | encoding | ) |
Definition at line 208 of file mbutils.c.
References backend_startup_complete, ConvProcInfo::c_encoding, ClientEncoding, ConvProcList, encoding, foreach_delete_current, GetDatabaseEncoding(), lfirst, pending_client_encoding, pfree(), pg_enc2name_tbl, PG_SQL_ASCII, PG_VALID_FE_ENCODING, ConvProcInfo::s_encoding, ConvProcInfo::to_client_info, ConvProcInfo::to_server_info, ToClientConvProc, and ToServerConvProc.
Referenced by assign_client_encoding(), InitializeClientEncoding(), and ParallelWorkerMain().
void SetDatabaseEncoding | ( | int | encoding | ) |
Definition at line 1161 of file mbutils.c.
References Assert, DatabaseEncoding, elog, encoding, pg_enc2name::encoding, ERROR, pg_enc2name_tbl, and PG_VALID_BE_ENCODING.
Referenced by CheckMyDatabase().
void SetMessageEncoding | ( | int | encoding | ) |
Definition at line 1171 of file mbutils.c.
References Assert, encoding, pg_enc2name::encoding, MessageEncoding, pg_enc2name_tbl, and PG_VALID_ENCODING.
Referenced by pg_perm_setlocale().
Definition at line 90 of file mbutils.c.
Referenced by InitializeClientEncoding(), PrepareClientEncoding(), and SetClientEncoding().
|
static |
Definition at line 80 of file mbutils.c.
Referenced by perform_default_encoding_conversion(), pg_any_to_server(), pg_client_encoding(), pg_client_to_server(), pg_get_client_encoding(), pg_get_client_encoding_name(), pg_server_to_any(), pg_server_to_client(), and SetClientEncoding().
Definition at line 61 of file mbutils.c.
Referenced by PrepareClientEncoding(), and SetClientEncoding().
|
static |
Definition at line 81 of file mbutils.c.
Referenced by getdatabaseencoding(), GetDatabaseEncoding(), GetDatabaseEncodingName(), perform_default_encoding_conversion(), pg_any_to_server(), pg_convert_from(), pg_convert_to(), pg_dsplen(), pg_mb2wchar(), pg_mb2wchar_with_len(), pg_mbcliplen(), pg_mblen(), pg_server_to_any(), pg_wchar2mb(), pg_wchar2mb_with_len(), and SetDatabaseEncoding().
|
static |
Definition at line 82 of file mbutils.c.
Referenced by GetMessageEncoding(), and SetMessageEncoding().
|
static |
Definition at line 91 of file mbutils.c.
Referenced by InitializeClientEncoding(), and SetClientEncoding().
|
static |
Definition at line 68 of file mbutils.c.
Referenced by perform_default_encoding_conversion(), and SetClientEncoding().
|
static |
Definition at line 67 of file mbutils.c.
Referenced by perform_default_encoding_conversion(), and SetClientEncoding().
|
static |
Definition at line 75 of file mbutils.c.
Referenced by InitializeClientEncoding(), pg_unicode_to_server(), and pg_unicode_to_server_noerror().