greenplumn charlen 源码

  • 2022-08-18
  • 浏览 (325)

greenplumn charlen 代码

文件路径:/gpcontrib/orafce/charlen.c

/*
 * charlen.c
 *
 * provides a modified version of bpcharlen() that does not
 * ignore trailing spaces of CHAR arguments to provide an
 * Oracle compatible length() function
 */

#include "postgres.h"

#include "utils/builtins.h"
#include "access/hash.h"
#include "libpq/pqformat.h"
#include "nodes/nodeFuncs.h"
#include "utils/array.h"
#include "utils/formatting.h"
#include "mb/pg_wchar.h"
#include "fmgr.h"

#include "orafce.h"
#include "builtins.h"

PG_FUNCTION_INFO_V1(orafce_bpcharlen);

Datum
orafce_bpcharlen(PG_FUNCTION_ARGS)
{
	BpChar     *arg = PG_GETARG_BPCHAR_PP(0);
	int         len;

	/* byte-length of the argument (trailing spaces not ignored) */
	len = VARSIZE_ANY_EXHDR(arg);

	/* in multibyte encoding, convert to number of characters */
	if (pg_database_encoding_max_length() != 1)
		len = pg_mbstrlen_with_len(VARDATA_ANY(arg), len);

	PG_RETURN_INT32(len);
}

相关信息

greenplumn 源码目录

相关文章

greenplumn aggregate 源码

greenplumn alert 源码

greenplumn assert 源码

greenplumn assert 源码

greenplumn builtins 源码

greenplumn charpad 源码

greenplumn convert 源码

greenplumn datefce 源码

greenplumn file 源码

greenplumn magic 源码

0  赞