From 60fcb5886ca2609e880bff2a36f7451f9eed5731 Mon Sep 17 00:00:00 2001 From: dimitr Date: Tue, 1 Apr 2008 12:04:08 +0000 Subject: [PATCH] More details about arithmetical exceptions. --- src/jrd/evl.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/jrd/evl.cpp b/src/jrd/evl.cpp index 7e437595ac..4af292b8e9 100644 --- a/src/jrd/evl.cpp +++ b/src/jrd/evl.cpp @@ -2862,7 +2862,12 @@ static dsc* binary_value(thread_db* tdbb, const jrd_nod* node, impure_value* imp { const double divisor = MOV_get_double(desc2); if (divisor == 0) - ERR_post(isc_arith_except, 0); + { + ERR_post(isc_arith_except, + isc_arg_gds, isc_exception_float_divide_by_zero, + isc_arg_sql_state, "22012", + 0); + } impure->vlu_misc.vlu_double = DOUBLE_DIVIDE(MOV_get_double(desc1), divisor); impure->vlu_desc.dsc_dtype = DEFAULT_DOUBLE; @@ -4200,7 +4205,12 @@ static dsc* divide2(const dsc* desc, impure_value* value, const jrd_nod* node) if (node->nod_flags & nod_double) { const double d2 = MOV_get_double(desc); if (d2 == 0.0) - ERR_post(isc_arith_except, 0); + { + ERR_post(isc_arith_except, + isc_arg_gds, isc_exception_float_divide_by_zero, + isc_arg_sql_state, "22012", + 0); + } const double d1 = MOV_get_double(&value->vlu_desc); value->vlu_misc.vlu_double = DOUBLE_DIVIDE(d1, d2); value->vlu_desc.dsc_dtype = DEFAULT_DOUBLE; @@ -4249,7 +4259,12 @@ static dsc* divide2(const dsc* desc, impure_value* value, const jrd_nod* node) */ SINT64 i2 = MOV_get_int64(desc, desc->dsc_scale); if (i2 == 0) - ERR_post(isc_arith_except, 0); + { + ERR_post(isc_arith_except, + isc_arg_gds, isc_exception_integer_divide_by_zero, + isc_arg_sql_state, "22012", + 0); + } SINT64 i1 = MOV_get_int64(&value->vlu_desc, node->nod_scale - desc->dsc_scale);