mirror of
https://github.com/postgres/postgres.git
synced 2025-12-19 17:02:53 +03:00
From: Thomas Lockhart <Thomas.G.Lockhart@jpl.nasa.gov>
Subject: [HACKERS] Money integration patches Here are patches to integrate the money data type. I have included some math and aggregate functions and have made the locale support optional by #ifdef USE_LOCALE bracketing of functions. Modules affected are: builtins.h.patch cash.c.patch cash.h.patch main.c.patch pg_aggregate.h.patch pg_operator.h.patch pg_proc.h.patch pg_type.h.patch I changed the data type to be pass-by-reference rather than by-value to pave the way for a larger internal representation (64-bit ints?). Also, I changed the tabbing of cash.c and cash.h to match most of the other Postgres source code files (4 space indent, 8 spaces == 1 tab). The locale stuff should be tested under another convention (Russian?) but I don't know what the correct results should be so perhaps someone else can give them a try. Will update docs and regression tests in the next few days.
This commit is contained in:
@@ -1,16 +1,35 @@
|
||||
/*
|
||||
cash.h
|
||||
Written by D'Arcy J.M. Cain
|
||||
* cash.h
|
||||
* Written by D'Arcy J.M. Cain
|
||||
*
|
||||
* Functions to allow input and output of money normally but store
|
||||
* and handle it as long integers.
|
||||
*/
|
||||
|
||||
functions to allow input and output of money normally but store
|
||||
and handle it as long integers
|
||||
*/
|
||||
#ifndef CASH_H
|
||||
#define CASH_H
|
||||
|
||||
#ifndef _CASH_H
|
||||
#define _CASH_H
|
||||
typedef long int Cash;
|
||||
|
||||
const char *cash_out(long value);
|
||||
long cash_in(const char *str);
|
||||
const char *cash_words_out(long value);
|
||||
const char *cash_out(Cash *value);
|
||||
Cash *cash_in(const char *str);
|
||||
|
||||
#endif /* _CASH_H */
|
||||
bool cash_eq(Cash *c1, Cash *c2);
|
||||
bool cash_ne(Cash *c1, Cash *c2);
|
||||
bool cash_lt(Cash *c1, Cash *c2);
|
||||
bool cash_le(Cash *c1, Cash *c2);
|
||||
bool cash_gt(Cash *c1, Cash *c2);
|
||||
bool cash_ge(Cash *c1, Cash *c2);
|
||||
|
||||
Cash *cash_pl(Cash *c1, Cash *c2);
|
||||
Cash *cash_mi(Cash *c1, Cash *c2);
|
||||
Cash *cash_mul(Cash *c, float8 *f);
|
||||
Cash *cash_div(Cash *c, float8 *f);
|
||||
|
||||
Cash *cashlarger(Cash *c1, Cash *c2);
|
||||
Cash *cashsmaller(Cash *c1, Cash *c2);
|
||||
|
||||
const char *cash_words_out(Cash *value);
|
||||
static const char *num_word(Cash value);
|
||||
|
||||
#endif /* CASH_H */
|
||||
|
||||
Reference in New Issue
Block a user