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
021778ee
Commit
021778ee
authored
Aug 22, 1997
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
We store Cash/money as int of size 4, so make it an int rather than a long.
parent
7515bb48
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
10 deletions
+11
-10
src/backend/parser/parser.c
src/backend/parser/parser.c
+4
-4
src/backend/utils/adt/cash.c
src/backend/utils/adt/cash.c
+4
-4
src/include/utils/cash.h
src/include/utils/cash.h
+3
-2
No files found.
src/backend/parser/parser.c
View file @
021778ee
...
...
@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.2
1 1997/08/22 00:02:08
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.2
2 1997/08/22 07:12:45
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -196,7 +196,7 @@ parser_typecast(Value *expr, TypeName *typename, int typlen)
case
T_Integer
:
const_string
=
(
char
*
)
palloc
(
256
);
string_palloced
=
true
;
sprintf
(
const_string
,
"%
l
d"
,
expr
->
val
.
ival
);
sprintf
(
const_string
,
"%d"
,
expr
->
val
.
ival
);
break
;
default:
elog
(
WARN
,
...
...
@@ -242,7 +242,7 @@ parser_typecast(Value *expr, TypeName *typename, int typlen)
case CASHOID: /* money */
const_string = (char *) palloc(256);
string_palloced = true;
sprintf(const_string,"%
l
d",
sprintf(const_string,"%d",
(int) ((Const*)expr)->constvalue);
break;
...
...
@@ -360,7 +360,7 @@ parser_typecast2(Node *expr, Oid exprType, Type tp, int typlen)
case
CASHOID
:
/* money */
const_string
=
(
char
*
)
palloc
(
256
);
string_palloced
=
true
;
sprintf
(
const_string
,
"%
l
d"
,
sprintf
(
const_string
,
"%d"
,
(
long
)
((
Const
*
)
expr
)
->
constvalue
);
break
;
case
TEXTOID
:
/* text */
...
...
src/backend/utils/adt/cash.c
View file @
021778ee
...
...
@@ -3,13 +3,13 @@
* Written by D'Arcy J.M. Cain
*
* Functions to allow input and output of money normally but store
* and handle it as
long
s
* and handle it as
int4
s
*
* A slightly modified version of this file and a discussion of the
* workings can be found in the book "Software Solutions in C" by
* Dale Schumacher, Academic Press, ISBN: 0-12-632360-7.
*
* $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.
8 1997/08/21 23:56:37
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.
9 1997/08/22 07:12:52
momjian Exp $
*/
#include <stdio.h>
...
...
@@ -97,7 +97,7 @@ cash_in(const char *str)
while
(
isspace
(
*
s
)
||
*
s
==
csymbol
)
s
++
;
for
(;
;
s
++
)
{
/* we look for digits as
long
as we have less */
/* we look for digits as
int4
as we have less */
/* than the required number of decimal places */
if
(
isdigit
(
*
s
)
&&
dec
<
fpoint
)
{
value
=
(
value
*
10
)
+
*
s
-
'0'
;
...
...
@@ -421,7 +421,7 @@ cashsmaller(Cash *c1, Cash *c2)
/* cash_words_out()
* This converts a
long
as well but to a representation using words
* This converts a
int4
as well but to a representation using words
* Obviously way North American centric - sorry
*/
const
char
*
...
...
src/include/utils/cash.h
View file @
021778ee
...
...
@@ -3,13 +3,14 @@
* Written by D'Arcy J.M. Cain
*
* Functions to allow input and output of money normally but store
* and handle it as
long integers
.
* and handle it as
int4
.
*/
#ifndef CASH_H
#define CASH_H
typedef
long
int
Cash
;
/* if we store this as 4 bytes, we better make it int, not long, bjm */
typedef
signed
int
Cash
;
extern
const
char
*
cash_out
(
Cash
*
value
);
extern
Cash
*
cash_in
(
const
char
*
str
);
...
...
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