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
239564e9
Commit
239564e9
authored
Dec 13, 1998
by
Thomas G. Lockhart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add routines to help with single-byte (internal) character type support.
parent
f9f4004b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
14 deletions
+42
-14
src/backend/utils/adt/char.c
src/backend/utils/adt/char.c
+20
-2
src/backend/utils/adt/varlena.c
src/backend/utils/adt/varlena.c
+19
-11
src/include/utils/builtins.h
src/include/utils/builtins.h
+3
-1
No files found.
src/backend/utils/adt/char.c
View file @
239564e9
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.
19 1998/09/01 03:25:50 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.
20 1998/12/13 23:35:48 thomas
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -29,7 +29,7 @@ int32
charin
(
char
*
ch
)
{
if
(
ch
==
NULL
)
return
(
int32
)
NULL
;
return
(
int32
)
'\0'
;
return
(
int32
)
*
ch
;
}
...
...
@@ -153,3 +153,21 @@ cideq(int8 arg1, int8 arg2)
{
return
arg1
==
arg2
;
}
int8
text_char
(
text
*
arg1
)
{
return
((
int8
)
*
(
VARDATA
(
arg1
)));
}
text
*
char_text
(
int8
arg1
)
{
text
*
result
;
result
=
palloc
(
VARHDRSZ
+
1
);
VARSIZE
(
result
)
=
VARHDRSZ
+
1
;
*
(
VARDATA
(
result
))
=
arg1
;
return
result
;
}
src/backend/utils/adt/varlena.c
View file @
239564e9
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.4
5 1998/12/08 06:19:15
thomas Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.4
6 1998/12/13 23:35:48
thomas Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -313,9 +313,8 @@ textcat(text *t1, text *t2)
* - starting position (is one-based)
* - string length
*
* If the starting position is zero or less, then return the entire string.
* XXX Note that this may not be the right behavior:
* if we are calculating the starting position we might want it to start at one.
* If the starting position is zero or less, then return from the start of the string
* adjusting the length to be consistant with the "negative start" per SQL92.
* If the length is less than zero, return the remaining string.
*
* Note that the arguments operate on octet length,
...
...
@@ -323,6 +322,9 @@ textcat(text *t1, text *t2)
*
* Added multi-byte support.
* - Tatsuo Ishii 1998-4-21
* Changed behavior if starting position is less than one to conform to SQL92 behavior.
* Formerly returned the entire string; now returns a portion.
* - Thomas Lockhart 1998-12-10
*/
text
*
text_substr
(
text
*
string
,
int32
m
,
int32
n
)
...
...
@@ -336,7 +338,7 @@ text_substr(text *string, int32 m, int32 n)
#endif
if
(
(
string
==
(
text
*
)
NULL
)
||
(
m
<=
0
)
)
if
(
string
==
(
text
*
)
NULL
)
return
string
;
len
=
VARSIZE
(
string
)
-
VARHDRSZ
;
...
...
@@ -344,19 +346,25 @@ text_substr(text *string, int32 m, int32 n)
len
=
pg_mbstrlen_with_len
(
VARDATA
(
string
),
len
);
#endif
/*
m will now become a zero-based starting position
*/
/*
starting position after the end of the string?
*/
if
(
m
>
len
)
{
m
=
0
;
m
=
1
;
n
=
0
;
}
else
/* starting position before the start of the string?
* then offset into the string per SQL92 spec... */
else
if
(
m
<
1
)
{
m
--
;
if
(((
m
+
n
)
>
len
)
||
(
n
<
0
))
n
=
(
len
-
m
);
n
+=
(
m
-
1
);
m
=
1
;
}
/* m will now become a zero-based starting position */
m
--
;
if
(((
m
+
n
)
>
len
)
||
(
n
<
0
))
n
=
(
len
-
m
);
#ifdef MULTIBYTE
p
=
VARDATA
(
string
);
for
(
i
=
0
;
i
<
m
;
i
++
)
...
...
src/include/utils/builtins.h
View file @
239564e9
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: builtins.h,v 1.7
1 1998/12/08 06:18:34
thomas Exp $
* $Id: builtins.h,v 1.7
2 1998/12/13 23:36:48
thomas Exp $
*
* NOTES
* This should normally only be included by fmgr.h.
...
...
@@ -60,6 +60,8 @@ extern int8 charmi(int8 arg1, int8 arg2);
extern
int8
charmul
(
int8
arg1
,
int8
arg2
);
extern
int8
chardiv
(
int8
arg1
,
int8
arg2
);
extern
bool
cideq
(
int8
arg1
,
int8
arg2
);
extern
int8
text_char
(
text
*
arg1
);
extern
text
*
char_text
(
int8
arg1
);
/* int.c */
extern
int32
int2in
(
char
*
num
);
...
...
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