Guardian C Library Calls Reference Manual

dec_to_longlong (supplementary)
3-24 128833Guardian TNS C Library Calls Reference Manual
Reference to Library Calls
dec_to_longlong (supplementary)
The dec_to_longlong function converts the SQL DECIMAL value stored in a C array of
decimal to a C long long value.
dec_ary
points to the first character of the decimal array that contains the SQL DECIMAL
value to convert.
chr_count
specifies the number of valid DECIMAL characters in *dec_ary.
ll_val
points to the variable of type long long where dec_to_longlong stores the converted
DECIMAL value.
Return Value
is zero if the conversion is successful; otherwise, dec_to_longlong returns one of
these status codes:
Usage Guidelines
When dec_to_longlong returns a nonzero value to indicate that the conversion was
not successful, the value stored in *ll_val is undefined.
For more information regarding the representation of SQL DECIMAL values in
C arrays of decimal, refer to the NonStop SQL Programming Manual for C.
#include <sqlh>
int dec_to_longlong(decimal *dec_ary, int chr_count,
long long *ll_val);
1
Indicates that significant digits of the DECIMAL value were truncated in the
conversion; that is, the converted value exceeded the bounds of a long long
value.
2
Indicates that the chr_count argument had an invalid value.
3
Indicates that *dec_ary contained characters that are not valid in SQL
DECIMAL values.