Home How To Online Documentation Support Download Order
 

 

 

 

SACommand
SAConnection
SAException
SAField
SAParam

SAString
SADateTime
SANumeric

Enums and Typedefs

  

Usage

Class Members

Examples

SAValueRead::asDouble

double  asDouble( ) const;
throw (SAException);

operator double( ) const;
throw (SAException);

asDouble method returns the value of current object (usually SAField or SAParam object) as double data.

operator double() substitute asDouble method to provide quick access for object's value.

Remarks

If the value of current object is NULL, asDouble method returns 0. Use SAValueRead::isNull method to make sure if the value is NULL or not.

If the value's type of current object is double (SA_dtDouble), asDouble method returns the original value with no conversion.

If the value's type of current object is bool (SA_dtBool ), short (SA_dtShort ), long (SA_dtLong) or numeric (SA_dtNumeric), asDouble method converts it to double ( SA_dtDouble ) data type.

If the value's type of current object is string (SA_dtString), asDouble method tries to convert it to double value. If the conversion is possible and correct, asDouble returns SA_dtDouble value. If conversion is incorrect asDouble method throws an exception.

If the value's type of current object is SA_dtDateTime, asDouble method converts it to standard double representation. Days are represented by whole number increments starting with 30 December 1899, midnight as time zero. Hour values are expressed as the absolute value of the fractional part of the number. See SADateTime::operator double() for more detailes.

If the value's type of current object is any data type except the described above, the result is undefined and debug version asserts.

Use SAValueRead::DataType method to get the value's type of SAValueRead object.

Server specific notes

No specific information.

See also

isNull, asBool, asShort, asLong, asNumeric, asDateTime, asString, asBytes, asLongBinary, asLongChar, asBLob, asCLob, asCursor, DataType

SADataType_t

Error handling

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.