summaryrefslogtreecommitdiff
path: root/sql/my_decimal.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-11-23 20:16:06 +0200
committerunknown <monty@mysql.com>2005-11-23 20:16:06 +0200
commit0b206536d521b2479feb9eef51484ed8191d6504 (patch)
treeacc41bf0974a50df9867c61707db33ae50dc402e /sql/my_decimal.cc
parent817ee181c34d53caf2179a978c35c685437fb756 (diff)
downloadmariadb-git-0b206536d521b2479feb9eef51484ed8191d6504.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 mysql-test/r/type_newdecimal.result: Moved long running query to type_newdecimal-big.test Removed warnings that depends on floating point comparisions mysql-test/t/type_newdecimal.test: Moved long running query to type_newdecimal-big.test Removed warnings that depends on floating point comparisions sql/field.cc: Indentation fixes sql/my_decimal.cc: Fixed that valgrind doesn't give warnings when running with debug strings/decimal.c: More DBUG printing mysql-test/r/type_newdecimal-big.result: New BitKeeper file ``mysql-test/r/type_newdecimal-big.result'' mysql-test/t/type_newdecimal-big.test: New BitKeeper file ``mysql-test/t/type_newdecimal-big.test''
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);
}