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
aaf11b93
Commit
aaf11b93
authored
Mar 22, 2003
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Back out to_char fixes until regression tests are fixed.
parent
05f916e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
53 deletions
+38
-53
src/backend/utils/adt/formatting.c
src/backend/utils/adt/formatting.c
+38
-53
No files found.
src/backend/utils/adt/formatting.c
View file @
aaf11b93
/* -----------------------------------------------------------------------
* formatting.c
*
* $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.
59 2003/03/20 05:19:26
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.
60 2003/03/22 02:12:24
momjian Exp $
*
*
* Portions Copyright (c) 1999-2002, PostgreSQL Global Development Group
...
...
@@ -276,19 +276,17 @@ typedef struct
* Flags for NUMBER version
* ----------
*/
#define NUM_F_DECIMAL 1 << 1
#define NUM_F_LDECIMAL 1 << 2
#define NUM_F_ZERO 1 << 3
#define NUM_F_BLANK 1 << 4
#define NUM_F_FILLMODE 1 << 5
#define NUM_F_LSIGN 1 << 6
#define NUM_F_BRACKET 1 << 7
#define NUM_F_MINUS 1 << 8
#define NUM_F_PLUS 1 << 9
#define NUM_F_ROMAN 1 << 10
#define NUM_F_MULTI 1 << 11
#define NUM_F_PLUS_POST 1 << 12
#define NUM_F_MINUS_POST 1 << 13
#define NUM_F_DECIMAL 0x01
#define NUM_F_LDECIMAL 0x02
#define NUM_F_ZERO 0x04
#define NUM_F_BLANK 0x08
#define NUM_F_FILLMODE 0x10
#define NUM_F_LSIGN 0x20
#define NUM_F_BRACKET 0x40
#define NUM_F_MINUS 0x80
#define NUM_F_PLUS 0x100
#define NUM_F_ROMAN 0x200
#define NUM_F_MULTI 0x400
#define NUM_LSIGN_PRE -1
#define NUM_LSIGN_POST 1
...
...
@@ -1054,8 +1052,6 @@ NUMDesc_prepare(NUMDesc *num, FormatNode *n)
elog
(
ERROR
,
"to_char/to_number(): can't use 'S' and 'MI' together."
);
}
num
->
flag
|=
NUM_F_MINUS
;
if
(
IS_DECIMAL
(
num
))
num
->
flag
|=
NUM_F_MINUS_POST
;
break
;
case
NUM_PL
:
...
...
@@ -1065,8 +1061,6 @@ NUMDesc_prepare(NUMDesc *num, FormatNode *n)
elog
(
ERROR
,
"to_char/to_number(): can't use 'S' and 'PL' together."
);
}
num
->
flag
|=
NUM_F_PLUS
;
if
(
IS_DECIMAL
(
num
))
num
->
flag
|=
NUM_F_PLUS_POST
;
break
;
case
NUM_SG
:
...
...
@@ -3886,36 +3880,28 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, char *number,
else
{
Np
->
sign
=
sign
;
/* MI/PL/SG - write sign itself and not in number */
if
(
IS_PLUS
(
Np
->
Num
)
||
IS_MINUS
(
Np
->
Num
))
if
(
Np
->
sign
!=
'-'
)
{
if
(
IS_PLUS
(
Np
->
Num
)
&&
IS_MINUS
(
Np
->
Num
)
==
FALSE
)
Np
->
sign_wrote
=
FALSE
;
Np
->
sign_pos
=
-
1
;
Np
->
Num
->
flag
&=
~
NUM_F_BRACKET
;
Np
->
Num
->
flag
&=
~
NUM_F_MINUS
;
}
else
if
(
Np
->
sign
!=
'+'
)
Np
->
Num
->
flag
&=
~
NUM_F_PLUS
;
if
(
Np
->
sign
==
'+'
&&
IS_FILLMODE
(
Np
->
Num
)
&&
!
IS_LSIGN
(
Np
->
Num
))
Np
->
sign_wrote
=
TRUE
;
/* needn't sign */
else
{
if
(
Np
->
sign
!=
'-'
)
{
if
(
IS_BRACKET
(
Np
->
Num
))
Np
->
Num
->
flag
&=
~
NUM_F_BRACKET
;
if
(
IS_MINUS
(
Np
->
Num
))
Np
->
Num
->
flag
&=
~
NUM_F_MINUS
;
}
else
if
(
Np
->
sign
!=
'+'
&&
IS_PLUS
(
Np
->
Num
))
Np
->
Num
->
flag
&=
~
NUM_F_PLUS
;
Np
->
sign_wrote
=
FALSE
;
/* need sign */
if
(
Np
->
sign
==
'+'
&&
IS_FILLMODE
(
Np
->
Num
)
&&
!
IS_LSIGN
(
Np
->
Num
))
Np
->
sign_wrote
=
TRUE
;
/* needn't sign */
else
Np
->
sign_wrote
=
FALSE
;
/* need sign */
Np
->
sign_pos
=
-
1
;
Np
->
sign_pos
=
-
1
;
if
(
Np
->
Num
->
lsign
==
NUM_LSIGN_PRE
&&
Np
->
Num
->
pre
==
Np
->
Num
->
pre_lsign_num
)
Np
->
Num
->
lsign
=
NUM_LSIGN_POST
;
if
(
Np
->
Num
->
lsign
==
NUM_LSIGN_PRE
&&
Np
->
Num
->
pre
==
Np
->
Num
->
pre_lsign_num
)
Np
->
Num
->
lsign
=
NUM_LSIGN_POST
;
}
/* MI/PL/SG - write sign itself and not in number */
if
(
IS_PLUS
(
Np
->
Num
)
||
IS_MINUS
(
Np
->
Num
))
Np
->
sign_wrote
=
TRUE
;
/* needn't sign */
}
/*
...
...
@@ -3931,7 +3917,7 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, char *number,
{
if
(
IS_DECIMAL
(
Np
->
Num
))
Np
->
last_relevant
=
get_last_relevant_decnum
(
Np
->
number
+
Np
->
number
+
((
Np
->
Num
->
zero_end
-
Np
->
num_pre
>
0
)
?
Np
->
Num
->
zero_end
-
Np
->
num_pre
:
0
));
}
...
...
@@ -3960,15 +3946,17 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, char *number,
/*
* terrible Ora format
*/
if
(
IS_ZERO
(
Np
->
Num
)
==
FALSE
&&
*
Np
->
number
==
'0'
&&
IS_FILLMODE
(
Np
->
Num
)
==
FALSE
&&
Np
->
Num
->
post
)
if
(
!
IS_ZERO
(
Np
->
Num
)
&&
*
Np
->
number
==
'0'
&&
!
IS_FILLMODE
(
Np
->
Num
)
&&
Np
->
Num
->
post
!=
0
)
{
++
Np
->
sign_pos
;
if
(
IS_LSIGN
(
Np
->
Num
))
{
if
(
Np
->
Num
->
lsign
!=
NUM_LSIGN_PRE
)
if
(
Np
->
Num
->
lsign
==
NUM_LSIGN_PRE
)
++
Np
->
sign_pos
;
else
--
Np
->
sign_pos
;
}
}
...
...
@@ -3987,8 +3975,8 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, char *number,
#ifdef DEBUG_TO_FROM_CHAR
elog
(
DEBUG_elog_output
,
"
\n\t
SIGN: '%c'
\n\t
NUM: '%s'
\n\t
PRE: %d
\n\t
POST: %d
\n\t
NUM_COUNT: %d
\n\t
NUM_PRE: %d
\n\t
SIGN_POS: %d
\n\t
SIGN_WROTE: %s
\n\t
ZERO: %s
\n\t
ZERO_START: %d
\n\t
ZERO_END: %d
\n\t
LAST_RELEVANT: %s
\n\t
BRACKET: %s
\n\t
PLUS: %s
\n\t
MINUS: %s"
,
Np
->
sign
,
"
\n\t
NUM: '%s'
\n\t
PRE: %d
\n\t
POST: %d
\n\t
NUM_COUNT: %d
\n\t
NUM_PRE: %d
\n\t
SIGN_POS: %d
\n\t
SIGN_WROTE: %s
\n\t
ZERO: %s
\n\t
ZERO_START: %d
\n\t
ZERO_END: %d
\n\t
LAST_RELEVANT: %s"
,
Np
->
number
,
Np
->
Num
->
pre
,
Np
->
Num
->
post
,
...
...
@@ -3999,11 +3987,8 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, char *number,
IS_ZERO
(
Np
->
Num
)
?
"Yes"
:
"No"
,
Np
->
Num
->
zero_start
,
Np
->
Num
->
zero_end
,
Np
->
last_relevant
?
Np
->
last_relevant
:
"<not set>"
,
IS_BRACKET
(
Np
->
Num
)
?
"Yes"
:
"No"
,
IS_PLUS
(
Np
->
Num
)
?
"Yes"
:
"No"
,
IS_MINUS
(
Np
->
Num
)
?
"Yes"
:
"No"
);
Np
->
last_relevant
?
Np
->
last_relevant
:
"<not set>"
);
#endif
/*
...
...
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