240
240
#define DIG_PER_DEC1 9
241
241
#define ROUND_UP(X) (((X)+DIG_PER_DEC1-1)/DIG_PER_DEC1)
245
print_decimal(const my_decimal *dec)
248
char buff[512], *pos;
250
pos+= my_sprintf(buff, (buff, "Decimal: sign: %d intg: %d frac: %d { ",
251
dec->sign(), dec->intg, dec->frac));
252
end= ROUND_UP(dec->frac)+ROUND_UP(dec->intg)-1;
253
for (i=0; i < end; i++)
254
pos+= my_sprintf(pos, (pos, "%09d, ", dec->buf[i]));
255
pos+= my_sprintf(pos, (pos, "%09d }\n", dec->buf[i]));
256
fputs(buff, DBUG_FILE);
260
/* print decimal with its binary representation */
262
print_decimal_buff(const my_decimal *dec, const uchar* ptr, int length)
265
fprintf(DBUG_FILE, "Record: ");
266
for (int i= 0; i < length; i++)
268
fprintf(DBUG_FILE, "%02X ", (uint)((uchar *)ptr)[i]);
270
fprintf(DBUG_FILE, "\n");
274
const char *dbug_decimal_as_string(char *buff, const my_decimal *val)
276
int length= DECIMAL_MAX_STR_LENGTH;
279
(void)decimal2string((decimal_t*) val, buff, &length, 0,0,0);
283
243
#endif /*MYSQL_CLIENT*/