summaryrefslogtreecommitdiff
path: root/src/backend/utils/mb/common.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-06-13 07:35:40 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-06-13 07:35:40 +0000
commitf2d120532207b8873a5e74e7350dd2904f377289 (patch)
tree992c89e023c4b29b42bf4fd6563de91f8d6ec8ca /src/backend/utils/mb/common.c
parent8f057d971d663fff9bbb2ae7d053bf71cf09b4a2 (diff)
downloadpostgresql-f2d120532207b8873a5e74e7350dd2904f377289.tar.gz
Another batch of fmgr updates. I think I have gotten all old-style
functions that take pass-by-value datatypes. Should be ready for port testing ...
Diffstat (limited to 'src/backend/utils/mb/common.c')
-rw-r--r--src/backend/utils/mb/common.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/backend/utils/mb/common.c b/src/backend/utils/mb/common.c
index 2927bc5e94..89f63ad2ec 100644
--- a/src/backend/utils/mb/common.c
+++ b/src/backend/utils/mb/common.c
@@ -2,7 +2,7 @@
* This file contains some public functions
* usable for both the backend and the frontend.
* Tatsuo Ishii
- * $Id: common.c,v 1.8 2000/01/18 05:14:24 ishii Exp $ */
+ * $Id: common.c,v 1.9 2000/06/13 07:35:15 tgl Exp $ */
#include <stdlib.h>
#include <string.h>
@@ -14,8 +14,10 @@
#endif
#include "postgres.h"
+
#include "miscadmin.h"
#include "mb/pg_wchar.h"
+#include "utils/builtins.h"
/*
* convert encoding char to encoding symbol value.
@@ -38,6 +40,15 @@ pg_char_to_encoding(const char *s)
return (p->encoding);
}
+/* Same, as an fmgr-callable function */
+Datum
+PG_char_to_encoding(PG_FUNCTION_ARGS)
+{
+ Name s = PG_GETARG_NAME(0);
+
+ PG_RETURN_INT32(pg_char_to_encoding(NameStr(*s)));
+}
+
/*
* check to see if encoding name is valid
*/
@@ -77,6 +88,15 @@ pg_encoding_to_char(int encoding)
return (p->name);
}
+/* Same, as an fmgr-callable function */
+Datum
+PG_encoding_to_char(PG_FUNCTION_ARGS)
+{
+ int32 encoding = PG_GETARG_INT32(0);
+
+ PG_RETURN_NAME(pg_encoding_to_char(encoding));
+}
+
/* returns the byte length of a multi-byte word for an encoding */
int
pg_encoding_mblen(int encoding, const unsigned char *mbstr)