From f3b00a0413804b26eeb610d3bc758a82e0ab33a9 Mon Sep 17 00:00:00 2001 From: "monty@mysql.com" <> Date: Sun, 20 Feb 2005 00:24:30 +0200 Subject: [PATCH] use dbug_print_decimal instead of DBUG_EXECUTE Portability fix Note: rpl_trunc_binlog fails, but Sergei has promised to fix it, so I will ignore it for now --- sql/field.cc | 12 ++++++------ sql/item.h | 4 ---- sql/my_decimal.cc | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/sql/field.cc b/sql/field.cc index 1da9bf6f7b0..a32b402cbdb 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1557,7 +1557,7 @@ bool Field_new_decimal::store_value(const my_decimal *decimal_value) my_decimal *dec= (my_decimal*)decimal_value; int error= 0; DBUG_ENTER("Field_new_decimal::store_value"); - DBUG_EXECUTE("enter", print_decimal(dec);); + dbug_print_decimal("enter", "value: %s", dec); /* check that we do not try to write negative value in unsigned field */ if (unsigned_flag && decimal_value->sign()) @@ -1569,7 +1569,7 @@ bool Field_new_decimal::store_value(const my_decimal *decimal_value) } DBUG_PRINT("info", ("saving with precision %d, scale: %d", (int)field_length, (int)decimals())); - DBUG_EXECUTE("info", print_decimal(dec);); + dbug_print_decimal("info", "value: %s", dec); if (warn_if_overflow(my_decimal2binary(E_DEC_FATAL_ERROR & ~E_DEC_OVERFLOW, @@ -1581,8 +1581,7 @@ bool Field_new_decimal::store_value(const my_decimal *decimal_value) DBUG_PRINT("info", ("overflow")); set_value_on_overflow(&buff, dec->sign()); my_decimal2binary(E_DEC_FATAL_ERROR, &buff, ptr, field_length, decimals()); - DBUG_EXECUTE("info", print_decimal_buff(&buff, (byte *) ptr, bin_size);); - DBUG_RETURN(1); + error= 1; } DBUG_EXECUTE("info", print_decimal_buff(dec, (byte *) ptr, bin_size);); DBUG_RETURN(error); @@ -1616,7 +1615,7 @@ int Field_new_decimal::store(const char *from, uint length, break; } - DBUG_EXECUTE("info", print_decimal(&decimal_value);); + dbug_print_decimal("enter", "value: %s", &decimal_value); store_value(&decimal_value); DBUG_RETURN(err); } @@ -1708,7 +1707,8 @@ my_decimal* Field_new_decimal::val_decimal(my_decimal *decimal_value) binary2my_decimal(E_DEC_FATAL_ERROR, ptr, decimal_value, field_length, decimals()); - DBUG_EXECUTE("info", print_decimal_buff(decimal_value, (byte *) ptr, bin_size);); + DBUG_EXECUTE("info", print_decimal_buff(decimal_value, (byte *) ptr, + bin_size);); DBUG_RETURN(decimal_value); } diff --git a/sql/item.h b/sql/item.h index 6ca61d21467..2b719840357 100644 --- a/sql/item.h +++ b/sql/item.h @@ -463,11 +463,7 @@ public: longlong val_int(); String *val_str(String *sp); my_decimal *val_decimal(my_decimal *); -#ifdef __WIN__ bool is_null(); -#else - inline bool is_null(); -#endif void print(String *str); inline void make_field(Send_field *field) diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc index 3e3538a1da9..334c40c0f70 100644 --- a/sql/my_decimal.cc +++ b/sql/my_decimal.cc @@ -228,7 +228,7 @@ void dbug_print_decimal(const char *tag, const char *format, my_decimal *val) str.set("NULL", 4, &my_charset_bin); else my_decimal2string(0, val, 0, 0, 0, &str); - DBUG_PRINT(tag, (format, val)); + DBUG_PRINT(tag, (format, (char*) str.ptr())); } #endif