| 4317 | |
| 4318 | |
| 4319 | static void |
| 4320 | print_table_data_vertically(MYSQL_RES *result) |
| 4321 | { |
| 4322 | MYSQL_ROW cur; |
| 4323 | uint max_length=0; |
| 4324 | MYSQL_FIELD *field; |
| 4325 | |
| 4326 | while ((field = mysql_fetch_field(result))) |
| 4327 | { |
| 4328 | uint length= field->name_length; |
| 4329 | if (length > max_length) |
| 4330 | max_length= length; |
| 4331 | field->max_length=length; |
| 4332 | } |
| 4333 | |
| 4334 | mysql_field_seek(result,0); |
| 4335 | for (uint row_count=1; (cur = fetch_row(result)); row_count++) |
| 4336 | { |
| 4337 | if (interrupted_query) |
| 4338 | break; |
| 4339 | mysql_field_seek(result,0); |
| 4340 | tee_fprintf(PAGER, |
| 4341 | "*************************** %d. row ***************************\n", row_count); |
| 4342 | |
| 4343 | ulong *lengths= mysql_fetch_lengths(result); |
| 4344 | |
| 4345 | for (uint off=0; off < mysql_num_fields(result); off++) |
| 4346 | { |
| 4347 | field= mysql_fetch_field(result); |
| 4348 | if (column_names) |
| 4349 | tee_fprintf(PAGER, "%*s: ",(int) max_length,field->name); |
| 4350 | if (cur[off]) |
| 4351 | { |
| 4352 | unsigned int i; |
| 4353 | const char *p; |
| 4354 | if (opt_binhex && is_binary_field(field)) |
| 4355 | fprintf(PAGER, "0x"); |
| 4356 | for (i= 0, p= cur[off]; i < lengths[off]; i+= 1, p+= 1) |
| 4357 | { |
| 4358 | if (opt_binhex && is_binary_field(field)) |
| 4359 | fprintf(PAGER, "%02X", *((uchar*)p)); |
| 4360 | else |
| 4361 | { |
| 4362 | if (*p == '\0') |
| 4363 | tee_putc((int)' ', PAGER); |
| 4364 | else |
| 4365 | tee_putc((int)*p, PAGER); |
| 4366 | } |
| 4367 | } |
| 4368 | tee_putc('\n', PAGER); |
| 4369 | } |
| 4370 | else |
| 4371 | tee_fprintf(PAGER, "NULL\n"); |
| 4372 | } |
| 4373 | } |
| 4374 | } |
| 4375 | |
| 4376 | /* print_warnings should be called right after executing a statement */ |
no test coverage detected