FreeTDS API
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
Money functions

Functions to manipulate the MONEY datatype. More...

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 dbmny4divide (DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *quotient)
 Divide two DBMONEY4 values. More...
 
RETCODE dbmny4minus (DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest)
 Negate a DBMONEY4 value. More...
 
RETCODE dbmny4mul (DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *prod)
 Multiply two DBMONEY4 values. 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...
 
RETCODE dbmnyadd (DBPROCESS *dbproc, DBMONEY *m1, DBMONEY *m2, DBMONEY *sum)
 Add two DBMONEY values. 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 dbmnydivide (DBPROCESS *dbproc, DBMONEY *m1, DBMONEY *m2, DBMONEY *quotient)
 Divide two DBMONEY values. More...
 
RETCODE dbmnydown (DBPROCESS *dbproc, DBMONEY *amount, int divisor, int *remainder)
 Divide a DBMONEY value by a positive integer. More...
 
RETCODE dbmnyinc (DBPROCESS *dbproc, DBMONEY *amount)
 Add $0.0001 to a DBMONEY value. More...
 
RETCODE dbmnyinit (DBPROCESS *dbproc, DBMONEY *amount, int trim, DBBOOL *negative)
 Prepare a DBMONEY value for use with dbmnyndigit(). 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 dbmnymul (DBPROCESS *dbproc, DBMONEY *m1, DBMONEY *m2, DBMONEY *prod)
 Multiply two DBMONEY values. More...
 
RETCODE dbmnyndigit (DBPROCESS *dbproc, DBMONEY *mnyptr, DBCHAR *digit, DBBOOL *zero)
 Get the least significant digit of a DBMONEY value, represented as a character. More...
 
RETCODE dbmnyscale (DBPROCESS *dbproc, DBMONEY *amount, int multiplier, int addend)
 Multiply a DBMONEY value by a positive integer, and add an amount. More...
 
RETCODE dbmnysub (DBPROCESS *dbproc, DBMONEY *m1, DBMONEY *m2, DBMONEY *difference)
 Subtract two DBMONEY values. More...
 
RETCODE dbmnyzero (DBPROCESS *dbproc, DBMONEY *dest)
 Set a DBMONEY value to zero. More...
 

Detailed Description

Functions to manipulate the MONEY datatype.

Function Documentation

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

Add two DBMONEY4 values.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
m1first operand.
m2other operand.
sumoutput: result of computation.
Return values
SUCCEEDusually.
FAILon overflow.
See Also
dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
int dbmny4cmp ( DBPROCESS dbproc,
DBMONEY4 m1,
DBMONEY4 m2 
)

Compare two DBMONEY4 values.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
m1some money.
m2some other money.
Return values
0m1 == m2.
-1m1 < m2.
1m1 > m2.
See Also
dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
RETCODE dbmny4copy ( DBPROCESS dbproc,
DBMONEY4 src,
DBMONEY4 dest 
)

Copy a DBMONEY4 value.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
srcaddress of a DBMONEY4 structure.
destoutput: new money.
Return values
SUCCEEDor FAIL if src/dest NULL.
See Also
dbmnycopy(), dbmnyminus(), dbmny4minus().
RETCODE dbmny4divide ( DBPROCESS dbproc,
DBMONEY4 m1,
DBMONEY4 m2,
DBMONEY4 quotient 
)

Divide two DBMONEY4 values.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
m1dividend.
m2divisor.
quotientoutput: result of computation.
Return values
SUCCEEDusually.
FAILa parameter is NULL.
See Also
dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
Todo:
Unimplemented.
RETCODE dbmny4minus ( DBPROCESS dbproc,
DBMONEY4 src,
DBMONEY4 dest 
)

Negate a DBMONEY4 value.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
srcaddress of a DBMONEY4 structure.
destoutput: result of negation.
Return values
SUCCEEDusually.
FAILon overflow.
See Also
dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
RETCODE dbmny4mul ( DBPROCESS dbproc,
DBMONEY4 m1,
DBMONEY4 m2,
DBMONEY4 prod 
)

Multiply two DBMONEY4 values.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
m1first operand.
m2other operand.
prodoutput: result of computation.
Return values
SUCCEEDusually.
FAILa parameter is NULL.
See Also
dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
Todo:
Unimplemented.
RETCODE dbmny4sub ( DBPROCESS dbproc,
DBMONEY4 m1,
DBMONEY4 m2,
DBMONEY4 diff 
)

Subtract two DBMONEY4 values.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
m1first operand.
m2other operand, subtracted from m1.
diffoutput: result of computation.
Return values
SUCCEEDusually.
FAILon overflow.
See Also
dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
RETCODE dbmny4zero ( DBPROCESS dbproc,
DBMONEY4 dest 
)

Zero a DBMONEY4 value.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
destaddress of a DBMONEY structure.
Return values
SUCCEEDusually.
FAILdest is NULL.
See Also
dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
RETCODE dbmnyadd ( DBPROCESS dbproc,
DBMONEY m1,
DBMONEY m2,
DBMONEY sum 
)

Add two DBMONEY values.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
m1first operand.
m2other operand.
sumoutput: result of computation.
Return values
SUCCEEDAlways.
See Also
dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
Todo:
Unimplemented.
int dbmnycmp ( DBPROCESS dbproc,
DBMONEY m1,
DBMONEY m2 
)

Compare two DBMONEY values.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
m1some money.
m2some other money.
Return values
0m1 == m2.
-1m1 < m2.
1m1 > m2.
See Also
dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
RETCODE dbmnycopy ( DBPROCESS dbproc,
DBMONEY src,
DBMONEY dest 
)

Copy a DBMONEY value.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
srcaddress of a DBMONEY structure.
destoutput: new money.
Return values
SUCCEEDalways, unless src or dest is NULL.
See Also
RETCODE dbmnydec ( DBPROCESS dbproc,
DBMONEY amount 
)

Subtract $0.0001 from a DBMONEY value.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
amountaddress of a DBMONEY structure.
Return values
SUCCEEDor FAIL if overflow or amount NULL.
See Also
dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
RETCODE dbmnydivide ( DBPROCESS dbproc,
DBMONEY m1,
DBMONEY m2,
DBMONEY quotient 
)

Divide two DBMONEY values.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
m1dividend.
m2divisor.
quotientoutput: result of computation.
Return values
SUCCEEDAlways.
See Also
dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
Todo:
Unimplemented.
RETCODE dbmnydown ( DBPROCESS dbproc,
DBMONEY amount,
int  divisor,
int *  remainder 
)

Divide a DBMONEY value by a positive integer.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
amountaddress of a DBMONEY structure.
divisorof amount.
remainderoutput: modulo of integer division.
Return values
SUCCEEDAlways.
See Also
dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
Todo:
Unimplemented.
RETCODE dbmnyinc ( DBPROCESS dbproc,
DBMONEY amount 
)

Add $0.0001 to a DBMONEY value.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
amountaddress of a DBMONEY structure.
Return values
SUCCEEDor FAIL if overflow or amount NULL.
See Also
dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
RETCODE dbmnyinit ( DBPROCESS dbproc,
DBMONEY amount,
int  trim,
DBBOOL *  negative 
)

Prepare a DBMONEY value for use with dbmnyndigit().

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
amountaddress of a DBMONEY structure.
trimnumber of digits to trim from amount.
negativeoutput: TRUE if amount < 0.
Return values
SUCCEEDAlways.
See Also
dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
Todo:
Unimplemented.
RETCODE dbmnymaxneg ( DBPROCESS dbproc,
DBMONEY amount 
)

Get maximum negative DBMONEY value supported.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
amountaddress of a DBMONEY structure.
Return values
SUCCEEDAlways.
See Also
dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
RETCODE dbmnymaxpos ( DBPROCESS dbproc,
DBMONEY amount 
)

Get maximum positive DBMONEY value supported.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
amountaddress of a DBMONEY structure.
Return values
SUCCEEDAlways.
See Also
dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
RETCODE dbmnyminus ( DBPROCESS dbproc,
DBMONEY src,
DBMONEY dest 
)

Negate a DBMONEY value.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
srcaddress of a DBMONEY structure.
destoutput: result of negation.
Return values
SUCCEEDor FAIL if overflow or src/dest NULL.
See Also
dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
RETCODE dbmnymul ( DBPROCESS dbproc,
DBMONEY m1,
DBMONEY m2,
DBMONEY prod 
)

Multiply two DBMONEY values.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
m1first operand.
m2other operand.
prodoutput: result of computation.
Return values
SUCCEEDAlways.
See Also
dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
Todo:
Unimplemented.
RETCODE dbmnyndigit ( DBPROCESS dbproc,
DBMONEY mnyptr,
DBCHAR *  digit,
DBBOOL *  zero 
)

Get the least significant digit of a DBMONEY value, represented as a character.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
mnyptrinput the money amount, and output: mnyptr divided by 10.
digitthe character value (between '0' and '9') of the rightmost digit in mnyptr.
zerooutput: TRUE if mnyptr is zero on output, else FALSE.
Return values
SUCCEEDAlways.
See Also
dbconvert(), dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
Remarks
Unimplemented and likely to remain so. We'd be amused to learn anyone wants this function.
Todo:
Unimplemented.
RETCODE dbmnyscale ( DBPROCESS dbproc,
DBMONEY amount,
int  multiplier,
int  addend 
)

Multiply a DBMONEY value by a positive integer, and add an amount.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
amountstarting amount of money, also holds output.
multiplieramount to multiply amount by.
addendamount to add to amount, after multiplying by multiplier.
Return values
SUCCEEDAlways.
Remarks
This function is goofy.
See Also
dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
Todo:
Unimplemented.
RETCODE dbmnysub ( DBPROCESS dbproc,
DBMONEY m1,
DBMONEY m2,
DBMONEY difference 
)

Subtract two DBMONEY values.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
m1first operand.
m2other operand, subtracted from m1.
differenceoutput: result of computation.
Return values
SUCCEEDAlways.
See Also
dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
Todo:
Unimplemented.
RETCODE dbmnyzero ( DBPROCESS dbproc,
DBMONEY dest 
)

Set a DBMONEY value to zero.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
destaddress of a DBMONEY structure.
Return values
SUCCEEDunless amount is NULL.
See Also
dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().