cash.h 544 B

12345678910111213141516171819202122232425
  1. /*
  2. * src/include/utils/cash.h
  3. *
  4. *
  5. * cash.h
  6. * Written by D'Arcy J.M. Cain
  7. *
  8. * Functions to allow input and output of money normally but store
  9. * and handle it as 64 bit integer.
  10. */
  11. #ifndef CASH_H
  12. #define CASH_H
  13. #include "fmgr.h"
  14. typedef int64 Cash;
  15. /* Cash is pass-by-reference if and only if int64 is */
  16. #define DatumGetCash(X) ((Cash) DatumGetInt64(X))
  17. #define CashGetDatum(X) Int64GetDatum(X)
  18. #define PG_GETARG_CASH(n) DatumGetCash(PG_GETARG_DATUM(n))
  19. #define PG_RETURN_CASH(x) return CashGetDatum(x)
  20. #endif /* CASH_H */