Skip to content

Commit be629ab

Browse files
committed
Add pg_database_encoding_max_length() function.
1 parent fae50f8 commit be629ab

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/backend/utils/mb/wchar.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* conversion functions between pg_wchar and multi-byte streams.
33
* Tatsuo Ishii
4-
* $Id: wchar.c,v 1.21 2001/09/21 15:27:38 tgl Exp $
4+
* $Id: wchar.c,v 1.22 2001/09/23 10:59:45 ishii Exp $
55
*
66
* WIN1250 client encoding updated by Pavel Behal
77
*
@@ -573,4 +573,14 @@ pg_verifymbstr(const unsigned char *mbstr, int len)
573573
}
574574
return NULL;
575575
}
576+
577+
/*
578+
* fetch maximum length of a char encoding for the current database
579+
*/
580+
int
581+
pg_database_encoding_max_length(void)
582+
{
583+
return pg_wchar_table[GetDatabaseEncoding()].maxmblen;
584+
}
585+
576586
#endif

src/include/mb/pg_wchar.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: pg_wchar.h,v 1.31 2001/09/21 15:27:38 tgl Exp $ */
1+
/* $Id: pg_wchar.h,v 1.32 2001/09/23 10:59:45 ishii Exp $ */
22

33
#ifndef PG_WCHAR_H
44
#define PG_WCHAR_H
@@ -226,6 +226,7 @@ extern int pg_mbstrlen_with_len(const unsigned char *, int);
226226
extern int pg_mbcliplen(const unsigned char *, int, int);
227227
extern int pg_mbcharcliplen(const unsigned char *, int, int);
228228
extern int pg_encoding_max_length(int);
229+
extern int pg_database_encoding_max_length(void);
229230

230231
extern int pg_set_client_encoding(int);
231232
extern int pg_get_client_encoding(void);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy