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

Function initializeUtf8ToServerConvProc

gpcontrib/orafce/convert.c:814–848  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

812}
813
814static void
815initializeUtf8ToServerConvProc(void)
816{
817 int current_server_encoding;
818
819 orafce_Utf8ToServerConvProc = NULL;
820
821 /*
822 * Also look up the UTF8-to-server conversion function if needed. Since
823 * the server encoding is fixed within any one backend process, we don't
824 * have to do this more than once.
825 */
826 current_server_encoding = GetDatabaseEncoding();
827 if (current_server_encoding != PG_UTF8 &&
828 current_server_encoding != PG_SQL_ASCII)
829 {
830 Oid utf8_to_server_proc;
831
832 utf8_to_server_proc =
833 FindDefaultConversionProc(PG_UTF8,
834 current_server_encoding);
835 /* If there's no such conversion, just leave the pointer as NULL */
836 if (OidIsValid(utf8_to_server_proc))
837 {
838 FmgrInfo *finfo;
839
840 finfo = (FmgrInfo *) MemoryContextAlloc(TopMemoryContext,
841 sizeof(FmgrInfo));
842 fmgr_info_cxt(utf8_to_server_proc, finfo,
843 TopMemoryContext);
844 /* Set Utf8ToServerConvProc only after data is fully valid */
845 orafce_Utf8ToServerConvProc = finfo;
846 }
847 }
848}
849
850#endif
851

Callers 1

orafce_unistrFunction · 0.85

Calls 4

GetDatabaseEncodingFunction · 0.85
MemoryContextAllocFunction · 0.85
fmgr_info_cxtFunction · 0.85

Tested by

no test coverage detected