/**********************************************************************//** Reads from an undo log update record the system field values of the old version. @return remaining part of undo log record after reading these values */ UNIV_INTERN byte* trx_undo_update_rec_get_sys_cols( /*=============================*/ byte* ptr, /*!< in: remaining part of undo log record after reading general parameters */ trx_id_t* trx_id, /*!< out: trx id */ roll_ptr_t* roll_ptr, /*!< out: roll ptr */ ulint* info_bits) /*!< out: info bits state */ { /* Read the state of the info bits */ *info_bits = mach_read_from_1(ptr); ptr += 1; /* Read the values of the system columns */ *trx_id = mach_ull_read_compressed(ptr); ptr += mach_ull_get_compressed_size(*trx_id); *roll_ptr = mach_ull_read_compressed(ptr); ptr += mach_ull_get_compressed_size(*roll_ptr); return(ptr); }
/*************************************************************//** Pretty prints a dfield value according to its data type. Also the hex string is printed if a string contains non-printable characters. */ UNIV_INTERN void dfield_print_also_hex( /*==================*/ const dfield_t* dfield) /*!< in: dfield */ { const byte* data; ulint len; ulint prtype; ulint i; ibool print_also_hex; len = dfield_get_len(dfield); data = dfield_get_data(dfield); if (dfield_is_null(dfield)) { fputs("NULL", stderr); return; } prtype = dtype_get_prtype(dfield_get_type(dfield)); switch (dtype_get_mtype(dfield_get_type(dfield))) { ib_id_t id; case DATA_INT: switch (len) { ulint val; case 1: val = mach_read_from_1(data); if (!(prtype & DATA_UNSIGNED)) { val &= ~0x80; fprintf(stderr, "%ld", (long) val); } else { fprintf(stderr, "%lu", (ulong) val); } break; case 2: val = mach_read_from_2(data); if (!(prtype & DATA_UNSIGNED)) { val &= ~0x8000; fprintf(stderr, "%ld", (long) val); } else { fprintf(stderr, "%lu", (ulong) val); } break; case 3: val = mach_read_from_3(data); if (!(prtype & DATA_UNSIGNED)) { val &= ~0x800000; fprintf(stderr, "%ld", (long) val); } else { fprintf(stderr, "%lu", (ulong) val); } break; case 4: val = mach_read_from_4(data); if (!(prtype & DATA_UNSIGNED)) { val &= ~0x80000000; fprintf(stderr, "%ld", (long) val); } else { fprintf(stderr, "%lu", (ulong) val); } break; case 6: id = mach_read_from_6(data); fprintf(stderr, "%llu", (ullint) id); break; case 7: id = mach_read_from_7(data); fprintf(stderr, "%llu", (ullint) id); break; case 8: id = mach_read_from_8(data); fprintf(stderr, "%llu", (ullint) id); break; default: goto print_hex; } break; case DATA_SYS: switch (prtype & DATA_SYS_PRTYPE_MASK) { case DATA_TRX_ID: id = mach_read_from_6(data); fprintf(stderr, "trx_id " TRX_ID_FMT, (ullint) id); break; case DATA_ROLL_PTR: id = mach_read_from_7(data); fprintf(stderr, "roll_ptr " TRX_ID_FMT, (ullint) id); break; case DATA_ROW_ID: id = mach_read_from_6(data); fprintf(stderr, "row_id " TRX_ID_FMT, (ullint) id); break; default: id = mach_ull_read_compressed(data); fprintf(stderr, "mix_id " TRX_ID_FMT, (ullint) id); } break; case DATA_CHAR: case DATA_VARCHAR: print_also_hex = FALSE; for (i = 0; i < len; i++) { int c = *data++; if (!isprint(c)) { print_also_hex = TRUE; fprintf(stderr, "\\x%02x", (unsigned char) c); } else { putc(c, stderr); } } if (dfield_is_ext(dfield)) { fputs("(external)", stderr); } if (!print_also_hex) { break; } data = dfield_get_data(dfield); /* fall through */ case DATA_BINARY: default: print_hex: fputs(" Hex: ",stderr); for (i = 0; i < len; i++) { fprintf(stderr, "%02lx", (ulint) *data++); } if (dfield_is_ext(dfield)) { fputs("(external)", stderr); } } }