Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
f52e7346
Commit
f52e7346
authored
Sep 25, 1998
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MB patches from Tatsuo Ishii
parent
31fea977
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
3 deletions
+46
-3
src/backend/utils/adt/varchar.c
src/backend/utils/adt/varchar.c
+15
-1
src/backend/utils/mb/mbutils.c
src/backend/utils/mb/mbutils.c
+29
-1
src/include/mb/pg_wchar.h
src/include/mb/pg_wchar.h
+2
-1
No files found.
src/backend/utils/adt/varchar.c
View file @
f52e7346
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.
39 1998/09/01 04:32:53
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.
40 1998/09/25 01:46:21
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -147,7 +147,14 @@ bpchar(char *s, int32 len)
if
((
len
==
-
1
)
||
(
len
==
VARSIZE
(
s
)))
return
s
;
#ifdef MULTIBYTE
/* truncate multi-byte string in a way not to break
multi-byte boundary */
rlen
=
pg_mbcliplen
(
VARDATA
(
s
),
len
-
VARHDRSZ
,
len
-
VARHDRSZ
);
len
=
rlen
+
VARHDRSZ
;
#else
rlen
=
len
-
VARHDRSZ
;
#endif
if
(
rlen
>
4096
)
elog
(
ERROR
,
"bpchar: length of char() must be less than 4096"
);
...
...
@@ -367,7 +374,14 @@ varchar(char *s, int32 slen)
/* only reach here if we need to truncate string... */
#ifdef MULTIBYTE
/* truncate multi-byte string in a way not to break
multi-byte boundary */
len
=
pg_mbcliplen
(
VARDATA
(
s
),
slen
-
VARHDRSZ
,
slen
-
VARHDRSZ
);
slen
=
len
+
VARHDRSZ
;
#else
len
=
slen
-
VARHDRSZ
;
#endif
if
(
len
>
4096
)
elog
(
ERROR
,
"varchar: length of varchar() must be less than 4096"
);
...
...
src/backend/utils/mb/mbutils.c
View file @
f52e7346
...
...
@@ -3,7 +3,7 @@
* client encoding and server internal encoding.
* (currently mule internal code (mic) is used)
* Tatsuo Ishii
* $Id: mbutils.c,v 1.
3 1998/09/01 04:33:22
momjian Exp $ */
* $Id: mbutils.c,v 1.
4 1998/09/25 01:46:23
momjian Exp $ */
#include <stdio.h>
#include <string.h>
...
...
@@ -201,6 +201,34 @@ pg_mbstrlen_with_len(const unsigned char *mbstr, int limit)
return
(
len
);
}
/*
* returns the length of a multi-byte string
* (not necessarily NULL terminated)
* that is not longer than limit.
* this function does not break multi-byte word boundary.
*/
int
pg_mbcliplen
(
const
unsigned
char
*
mbstr
,
int
len
,
int
limit
)
{
int
clen
=
0
;
int
l
;
while
(
*
mbstr
&&
len
>
0
)
{
l
=
pg_mblen
(
mbstr
);
if
((
clen
+
l
)
>
limit
)
{
break
;
}
clen
+=
l
;
if
(
clen
==
limit
)
{
break
;
}
len
-=
l
;
mbstr
+=
l
;
}
return
(
clen
);
}
/*
* fuctions for utils/init
*/
...
...
src/include/mb/pg_wchar.h
View file @
f52e7346
/* $Id: pg_wchar.h,v 1.
4 1998/09/01 04:36:34
momjian Exp $ */
/* $Id: pg_wchar.h,v 1.
5 1998/09/25 01:46:25
momjian Exp $ */
#ifndef PG_WCHAR_H
#define PG_WCHAR_H
...
...
@@ -103,6 +103,7 @@ extern int pg_mule_mblen(const unsigned char *);
extern
int
pg_mic_mblen
(
const
unsigned
char
*
);
extern
int
pg_mbstrlen
(
const
unsigned
char
*
);
extern
int
pg_mbstrlen_with_len
(
const
unsigned
char
*
,
int
);
extern
int
pg_mbcliplen
(
const
unsigned
char
*
,
int
,
int
);
extern
pg_encoding_conv_tbl
*
pg_get_encent_by_encoding
(
int
);
extern
bool
show_client_encoding
(
void
);
extern
bool
reset_client_encoding
(
void
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment