summaryrefslogtreecommitdiff
path: root/sql/my_decimal.cc
diff options
context:
space:
mode:
authormonty@mysql.com <>2005-11-23 20:16:06 +0200
committermonty@mysql.com <>2005-11-23 20:16:06 +0200
commite05630b17f2fcdbe7ee8f4fdedac74ddc6e96ff5 (patch)
treeacc41bf0974a50df9867c61707db33ae50dc402e /sql/my_decimal.cc
parent35735cfefa15d36f100e790b570dd548230a58e8 (diff)
downloadmariadb-git-e05630b17f2fcdbe7ee8f4fdedac74ddc6e96ff5.tar.gz
Moved long running query to type_newdecimal-big.test
Removed warnings that depends on floating point comparisions in type_newdecimal.test which caused failures in some setups
Diffstat (limited to 'sql/my_decimal.cc')
-rw-r--r--sql/my_decimal.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc
index 1bd16940b47..89607129026 100644
--- a/sql/my_decimal.cc
+++ b/sql/my_decimal.cc
@@ -193,16 +193,23 @@ int str2my_decimal(uint mask, const char *from, uint length,
#ifndef DBUG_OFF
/* routines for debugging print */
+#define DIG_PER_DEC1 9
+#define ROUND_UP(X) (((X)+DIG_PER_DEC1-1)/DIG_PER_DEC1)
+
/* print decimal */
void
print_decimal(const my_decimal *dec)
{
- fprintf(DBUG_FILE,
- "\nDecimal: sign: %d intg: %d frac: %d \n\
-%09d,%09d,%09d,%09d,%09d,%09d,%09d,%09d\n",
- dec->sign(), dec->intg, dec->frac,
- dec->buf[0], dec->buf[1], dec->buf[2], dec->buf[3],
- dec->buf[4], dec->buf[5], dec->buf[6], dec->buf[7]);
+ int i, end;
+ char buff[512], *pos;
+ pos= buff;
+ pos+= my_sprintf(buff, (buff, "Decimal: sign: %d intg: %d frac: %d { ",
+ dec->sign(), dec->intg, dec->frac));
+ end= ROUND_UP(dec->frac)+ROUND_UP(dec->intg)-1;
+ for (i=0; i < end; i++)
+ pos+= my_sprintf(pos, (pos, "%09d, ", dec->buf[i]));
+ pos+= my_sprintf(pos, (pos, "%09d }\n", dec->buf[i]));
+ fputs(buff, DBUG_FILE);
}