Skip to content

Commit

Permalink
Use %u in sql/table.cc’s my_snprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
ParadoxV5 committed Jul 20, 2024
1 parent c6c4ba4 commit 1207c8d
Showing 1 changed file with 39 additions and 37 deletions.
76 changes: 39 additions & 37 deletions sql/table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4069,14 +4069,13 @@ unpack_vcol_info_from_frm(THD *thd, TABLE *table,
#ifndef DBUG_OFF
static void print_long_unique_table(TABLE *table)
{
char buff[256];
char buff[256]= "Printing Table state, It will print table fields, "
"fields->offset,field->null_bit, field->null_pos and key_info ... \n\n"
"Printing Table keyinfo\n"
String str;
KEY *key_info_table, *key_info_share;
KEY_PART_INFO *key_part;
Field *field;
my_snprintf(buff, sizeof(buff), "Printing Table state, It will print table fields,"
" fields->offset,field->null_bit, field->null_pos and key_info ... \n"
"\nPrinting Table keyinfo\n");
str.append(buff, strlen(buff));
my_snprintf(buff, sizeof(buff), "\ntable->s->reclength %lu\n"
"table->s->fields %u\n",
Expand All @@ -4087,61 +4086,64 @@ static void print_long_unique_table(TABLE *table)
key_info_table= table->key_info + i;
key_info_share= table->s->key_info + i;
my_snprintf(buff, sizeof(buff),
"\ntable->key_info[%d] user_defined_key_parts = %d\n"
"table->key_info[%d] algorithm == HA_KEY_ALG_LONG_HASH = %d\n"
"table->key_info[%d] flags & HA_NOSAME = %lu\n",
"\ntable->key_info[%u] user_defined_key_parts = %u\n"
"table->key_info[%u] algorithm == HA_KEY_ALG_LONG_HASH = %d\n"
"table->key_info[%u] flags & HA_NOSAME = %lu\n",
i, key_info_table->user_defined_key_parts,
i, key_info_table->algorithm == HA_KEY_ALG_LONG_HASH,
i, key_info_table->flags & HA_NOSAME);
str.append(buff, strlen(buff));
my_snprintf(buff, sizeof(buff),
"\ntable->s->key_info[%d] user_defined_key_parts = %d\n"
"table->s->key_info[%d] algorithm == HA_KEY_ALG_LONG_HASH = %d\n"
"table->s->key_info[%d] flags & HA_NOSAME = %lu\n",
"\ntable->s->key_info[%u] user_defined_key_parts = %u\n"
"table->s->key_info[%u] algorithm == HA_KEY_ALG_LONG_HASH = %d\n"
"table->s->key_info[%u] flags & HA_NOSAME = %lu\n",
i, key_info_share->user_defined_key_parts,
i, key_info_share->algorithm == HA_KEY_ALG_LONG_HASH,
i, key_info_share->flags & HA_NOSAME);
str.append(buff, strlen(buff));
key_part = key_info_table->key_part;
my_snprintf(buff, sizeof(buff), "\nPrinting table->key_info[%d].key_part[0] info\n"
"key_part->offset = %d\n"
"key_part->field_name = %s\n"
"key_part->length = %d\n"
"key_part->null_bit = %d\n"
"key_part->null_offset = %d\n",
i, key_part->offset, key_part->field->field_name.str, key_part->length,
key_part->null_bit, key_part->null_offset);
my_snprintf(buff, sizeof(buff),
"\nPrinting table->key_info[%u].key_part[0] info\n"
"key_part->offset = %u\n"
"key_part->field_name = %s\n"
"key_part->length = %u\n"
"key_part->null_bit = %u\n"
"key_part->null_offset = %u\n",
i, key_part->offset, key_part->field->field_name.str, key_part->length,
key_part->null_bit, key_part->null_offset);
str.append(buff, strlen(buff));

for (uint j= 0; j < key_info_share->user_defined_key_parts; j++)
{
key_part= key_info_share->key_part + j;
my_snprintf(buff, sizeof(buff), "\nPrinting share->key_info[%d].key_part[%d] info\n"
"key_part->offset = %d\n"
"key_part->field_name = %s\n"
"key_part->length = %d\n"
"key_part->null_bit = %d\n"
"key_part->null_offset = %d\n",
i,j,key_part->offset, key_part->field->field_name.str, key_part->length,
key_part->null_bit, key_part->null_offset);
my_snprintf(buff, sizeof(buff),
"\nPrinting share->key_info[%u].key_part[%u] info\n"
"key_part->offset = %u\n"
"key_part->field_name = %s\n"
"key_part->length = %u\n"
"key_part->null_bit = %u\n"
"key_part->null_offset = %u\n",
i, j, key_part->offset, key_part->field->field_name.str,
key_part->length, key_part->null_bit, key_part->null_offset);
str.append(buff, strlen(buff));
}
}
my_snprintf(buff, sizeof(buff), "\nPrinting table->fields\n");
strcpy(buff, "\nPrinting table->fields\n");
str.append(buff, strlen(buff));
for(uint i= 0; i < table->s->fields; i++)
{
field= table->field[i];
my_snprintf(buff, sizeof(buff), "\ntable->field[%d]->field_name %s\n"
"table->field[%d]->offset = %ld\n"
"table->field[%d]->field_length = %d\n"
"table->field[%d]->null_pos wrt to record 0 = %ld\n"
"table->field[%d]->null_bit_pos = %d\n",
i, field->field_name.str,
i, field->ptr- table->record[0],
i, field->pack_length(),
i, field->null_bit ? field->null_ptr - table->record[0] : -1,
i, field->null_bit);
my_snprintf(buff, sizeof(buff),
"\ntable->field[%u]->field_name %s\n"
"table->field[%u]->offset = %ld\n"
"table->field[%u]->field_length = %d\n"
"table->field[%u]->null_pos wrt to record 0 = %ld\n"
"table->field[%u]->null_bit_pos = %d\n",
i, field->field_name.str,
i, field->ptr- table->record[0],
i, field->pack_length(),
i, field->null_bit ? field->null_ptr - table->record[0] : -1,
i, field->null_bit);
str.append(buff, strlen(buff));
}
(*error_handler_hook)(1, str.ptr(), ME_NOTE);
Expand Down

0 comments on commit 1207c8d

Please sign in to comment.