Home How To Online Documentation Support Download Order
 

 

 

SACommand
SAConnection
SAException
SAField
SAParam

SAString
SADateTime
SANumeric
SAInterval

Enums and Typedefs


Class Members

Examples

SANumeric object

SANumeric is a subsidiary class. The SANumeric class provides support for manipulating exact numeric values with a fixed precission and scale. The class supplies data members and operators for representind numeric values without precision loss. It is useful when working with such DBMS types as DECIMAL, NUMERIC, BIGINT, etc.

To create SANumericvalue use one of the following constructors :

  • SANumeric( ); - default constructor, creates empty SANumeric value.
  • SANumeric( double d ); - copy constructor, used to create new SANumeric value from double.
  • SANumeric( const SAChar *s ); - creates SANumeric value from string.

operator double converts an existing SANumericvalue to double. operator SAString allows to represent numeric value as a string without precision loss.

Data members precission, scale and sign allows to set or get the precission (the maximum number of digits), scale (the number of digits to the right of the decimal point) and sign of SANumeric object.

Data member val contains the numeric value as a 32-byte scaled integer.

For example, the base 10 number 123.4567 is scaled to an integer 1234567, which is 12D687 in hexadecimal. The value stored in the SA_NUMERIC_MANTISSA_SIZE-byte integer is 87 D6 12 00 00 00 00 00 00 00 00 00 00 00 00 ..... 00 00 00
(now SA_NUMERIC_MANTISSA_SIZE is defined as 32).
The precision is 7, the scale is 4, and the sign is 1.

Problems and Questions

If you haven't found the answer to your questions or have some problems on using the Library, please, send e-mail to howto@sqlapi.com.