MCPcopy Create free account
hub / github.com/apache/cloudberry / processEncodingEntry

Function processEncodingEntry

src/bin/pg_dump/pg_backup_archiver.c:2757–2784  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2755}
2756
2757static void
2758processEncodingEntry(ArchiveHandle *AH, TocEntry *te)
2759{
2760 /* te->defn should have the form SET client_encoding = 'foo'; */
2761 char *defn = pg_strdup(te->defn);
2762 char *ptr1;
2763 char *ptr2 = NULL;
2764 int encoding;
2765
2766 ptr1 = strchr(defn, '\'');
2767 if (ptr1)
2768 ptr2 = strchr(++ptr1, '\'');
2769 if (ptr2)
2770 {
2771 *ptr2 = '\0';
2772 encoding = pg_char_to_encoding(ptr1);
2773 if (encoding < 0)
2774 fatal("unrecognized encoding \"%s\"",
2775 ptr1);
2776 AH->public.encoding = encoding;
2777 setFmtEncoding(encoding);
2778 }
2779 else
2780 fatal("invalid ENCODING item: %s",
2781 te->defn);
2782
2783 free(defn);
2784}
2785
2786static void
2787processStdStringsEntry(ArchiveHandle *AH, TocEntry *te)

Callers 1

ReadTocFunction · 0.85

Calls 3

pg_strdupFunction · 0.85
pg_char_to_encodingFunction · 0.85
setFmtEncodingFunction · 0.85

Tested by

no test coverage detected