Money functions
The db-lib API

Functions to manipulate the MONEY datatype. More...

Collaboration diagram for Money functions:

## Functions

RETCODE | dbmny4add (DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *sum)
| Add two DBMONEY4 values. More...
int | dbmny4cmp (DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2)
| Compare two DBMONEY4 values. More...
RETCODE | dbmny4copy (DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest)
| Copy a DBMONEY4 value. More...
RETCODE | dbmny4minus (DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest)
| Negate a DBMONEY4 value. More...
RETCODE | dbmny4sub (DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *diff)
| Subtract two DBMONEY4 values. More...
RETCODE | dbmny4zero (DBPROCESS *dbproc, DBMONEY4 *dest)
| Zero a DBMONEY4 value. More...
int | dbmnycmp (DBPROCESS *dbproc, DBMONEY *m1, DBMONEY *m2)
| Compare two DBMONEY values. More...
RETCODE | dbmnycopy (DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest)
| Copy a DBMONEY value. More...
RETCODE | dbmnydec (DBPROCESS *dbproc, DBMONEY *amount)
| Subtract $0.0001 from a DBMONEY value. More...
RETCODE | dbmnyinc (DBPROCESS *dbproc, DBMONEY *amount)
| Add $0.0001 to a DBMONEY value. More...
RETCODE | dbmnymaxneg (DBPROCESS *dbproc, DBMONEY *amount)
| Get maximum negative DBMONEY value supported. More...
RETCODE | dbmnymaxpos (DBPROCESS *dbproc, DBMONEY *amount)
| Get maximum positive DBMONEY value supported. More...
RETCODE | dbmnyminus (DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest)
| Negate a DBMONEY value. More...
RETCODE | dbmnyzero (DBPROCESS *dbproc, DBMONEY *dest)
| Set a DBMONEY value to zero. More...

## Detailed Description

Functions to manipulate the MONEY datatype.

## Function Documentation

## dbmny4add()

RETCODE dbmny4add | ( | DBPROCESS * | dbproc,
|  | DBMONEY4 * | m1,
|  | DBMONEY4 * | m2,
|  | DBMONEY4 * | sum
| ) |  |

Add two DBMONEY4 values.

Parameters

  dbproc | contains all information needed by db-lib to manage communications with the server.
  m1 | first operand.
  m2 | other operand.
  sum | output: result of computation.

Return values

  SUCCEED | usually.
  FAIL | on overflow.

See also
  dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().

Here is the call graph for this function:

## dbmny4cmp()

int dbmny4cmp | ( | DBPROCESS * | dbproc,
|  | DBMONEY4 * | m1,
|  | DBMONEY4 * | m2
| ) |  |

Compare two DBMONEY4 values.

Parameters

  dbproc | contains all information needed by db-lib to manage communications with the server.
  m1 | some money.
  m2 | some other money.

Return values

  0 | m1 == m2.
  -1 | m1 < m2.
  1 | m1 > m2.

See also
  dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().

Here is the call graph for this function:

## dbmny4copy()

RETCODE dbmny4copy | ( | DBPROCESS * | dbproc,
|  | DBMONEY4 * | src,
|  | DBMONEY4 * | dest
| ) |  |

Copy a DBMONEY4 value.

Parameters

  dbproc | contains all information needed by db-lib to manage communications with the server.
  src | address of a DBMONEY4 structure.
  dest | output: new money.

Return values

  SUCCEED | or FAIL if src/dest NULL.

See also
  dbmnycopy(), dbmnyminus(), dbmny4minus().

Here is the call graph for this function:

## dbmny4minus()

RETCODE dbmny4minus | ( | DBPROCESS * | dbproc,
|  | DBMONEY4 * | src,
|  | DBMONEY4 * | dest
| ) |  |

Negate a DBMONEY4 value.

Parameters

  dbproc | contains all information needed by db-lib to manage communications with the server.
  src | address of a DBMONEY4 structure.
  dest | output: result of negation.

Return values

  SUCCEED | usually.
  FAIL | on overflow.

See also
  dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().

Here is the call graph for this function:

## dbmny4sub()

RETCODE dbmny4sub | ( | DBPROCESS * | dbproc,
|  | DBMONEY4 * | m1,
|  | DBMONEY4 * | m2,
|  | DBMONEY4 * | diff
| ) |  |

Subtract two DBMONEY4 values.

Parameters

  dbproc | contains all information needed by db-lib to manage communications with the server.
  m1 | first operand.
  m2 | other operand, subtracted from m1.
  diff | output: result of computation.

Return values

  SUCCEED | usually.
  FAIL | on overflow.

See also
  dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().

Here is the call graph for this function:

## dbmny4zero()

RETCODE dbmny4zero | ( | DBPROCESS * | dbproc,
|  | DBMONEY4 * | dest
| ) |  |

Zero a DBMONEY4 value.

Parameters

  dbproc | contains all information needed by db-lib to manage communications with the server.
  dest | address of a DBMONEY structure.

Return values

  SUCCEED | usually.
  FAIL | dest is NULL.

See also
  dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().

Here is the call graph for this function:

## dbmnycmp()

int dbmnycmp | ( | DBPROCESS * | dbproc,
|  | DBMONEY * | m1,
|  | DBMONEY * | m2
| ) |  |

Compare two DBMONEY values.

Parameters

  dbproc | contains all information needed by db-lib to manage communications with the server.
  m1 | some money.
  m2 | some other money.

Return values

  0 | m1 == m2.
  -1 | m1 < m2.
  1 | m1 > m2.

See also
  dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().

Here is the call graph for this function:

## dbmnycopy()

RETCODE dbmnycopy | ( | DBPROCESS * | dbproc,
|  | DBMONEY * | src,
|  | DBMONEY * | dest
| ) |  |

Copy a DBMONEY value.

Parameters

  dbproc | contains all information needed by db-lib to manage communications with the server.
  src | address of a DBMONEY structure.
  dest | output: new money.

Return values

  SUCCEED | always, unless src or dest is `NULL`.

See also

Here is the call graph for this function:

## dbmnydec()

RETCODE dbmnydec | ( | DBPROCESS * | dbproc,
|  | DBMONEY * | amount
| ) |  |

Subtract $0.0001 from a DBMONEY value.

Parameters

  dbproc | contains all information needed by db-lib to manage communications with the server.
  amount | address of a DBMONEY structure.

Return values

  SUCCEED | or FAIL if overflow or amount NULL.

See also
  dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().

Here is the call graph for this function:

## dbmnyinc()

RETCODE dbmnyinc | ( | DBPROCESS * | dbproc,
|  | DBMONEY * | amount
| ) |  |

Add $0.0001 to a DBMONEY value.

Parameters

  dbproc | contains all information needed by db-lib to manage communications with the server.
  amount | address of a DBMONEY structure.

Return values

  SUCCEED | or FAIL if overflow or amount NULL.

See also
  dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().

Here is the call graph for this function:

## dbmnymaxneg()

RETCODE dbmnymaxneg | ( | DBPROCESS * | dbproc,
|  | DBMONEY * | amount
| ) |  |

Get maximum negative DBMONEY value supported.

Parameters

  dbproc | contains all information needed by db-lib to manage communications with the server.
  amount | address of a DBMONEY structure.

Return values

  SUCCEED | Always.

See also
  dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().

Here is the call graph for this function:

## dbmnymaxpos()

RETCODE dbmnymaxpos | ( | DBPROCESS * | dbproc,
|  | DBMONEY * | amount
| ) |  |

Get maximum positive DBMONEY value supported.

Parameters

  dbproc | contains all information needed by db-lib to manage communications with the server.
  amount | address of a DBMONEY structure.

Return values

  SUCCEED | Always.

See also
  dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().

Here is the call graph for this function:

## dbmnyminus()

RETCODE dbmnyminus | ( | DBPROCESS * | dbproc,
|  | DBMONEY * | src,
|  | DBMONEY * | dest
| ) |  |

Negate a DBMONEY value.

Parameters

  dbproc | contains all information needed by db-lib to manage communications with the server.
  src | address of a DBMONEY structure.
  dest | output: result of negation.

Return values

  SUCCEED | or FAIL if overflow or src/dest NULL.

See also
  dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().

Here is the call graph for this function:

## dbmnyzero()

RETCODE dbmnyzero | ( | DBPROCESS * | dbproc,
|  | DBMONEY * | dest
| ) |  |

Set a DBMONEY value to zero.

Parameters

  dbproc | contains all information needed by db-lib to manage communications with the server.
  dest | address of a DBMONEY structure.

Return values

  SUCCEED | unless amount is NULL.

See also
  dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().

Here is the call graph for this function: