mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
Helper function for debugging.
This commit is contained in:
parent
1168e2fa54
commit
9810d5ea13
1 changed files with 45 additions and 1 deletions
46
sql/item.cc
46
sql/item.cc
|
@ -10126,7 +10126,7 @@ table_map Item_ref_null_helper::used_tables() const
|
|||
#ifndef DBUG_OFF
|
||||
|
||||
/* Debugger help function */
|
||||
static char dbug_item_print_buf[256];
|
||||
static char dbug_item_print_buf[2048];
|
||||
|
||||
const char *dbug_print_item(Item *item)
|
||||
{
|
||||
|
@ -10150,6 +10150,50 @@ const char *dbug_print_item(Item *item)
|
|||
return "Couldn't fit into buffer";
|
||||
}
|
||||
|
||||
const char *dbug_print_select(SELECT_LEX *sl)
|
||||
{
|
||||
char *buf= dbug_item_print_buf;
|
||||
String str(buf, sizeof(dbug_item_print_buf), &my_charset_bin);
|
||||
str.length(0);
|
||||
if (!sl)
|
||||
return "(SELECT_LEX*)NULL";
|
||||
|
||||
THD *thd= current_thd;
|
||||
ulonglong save_option_bits= thd->variables.option_bits;
|
||||
thd->variables.option_bits &= ~OPTION_QUOTE_SHOW_CREATE;
|
||||
|
||||
sl->print(thd, &str, QT_EXPLAIN);
|
||||
|
||||
thd->variables.option_bits= save_option_bits;
|
||||
|
||||
if (str.c_ptr() == buf)
|
||||
return buf;
|
||||
else
|
||||
return "Couldn't fit into buffer";
|
||||
}
|
||||
|
||||
const char *dbug_print_unit(SELECT_LEX_UNIT *un)
|
||||
{
|
||||
char *buf= dbug_item_print_buf;
|
||||
String str(buf, sizeof(dbug_item_print_buf), &my_charset_bin);
|
||||
str.length(0);
|
||||
if (!un)
|
||||
return "(SELECT_LEX_UNIT*)NULL";
|
||||
|
||||
THD *thd= current_thd;
|
||||
ulonglong save_option_bits= thd->variables.option_bits;
|
||||
thd->variables.option_bits &= ~OPTION_QUOTE_SHOW_CREATE;
|
||||
|
||||
un->print(&str, QT_EXPLAIN);
|
||||
|
||||
thd->variables.option_bits= save_option_bits;
|
||||
|
||||
if (str.c_ptr() == buf)
|
||||
return buf;
|
||||
else
|
||||
return "Couldn't fit into buffer";
|
||||
}
|
||||
|
||||
|
||||
#endif /*DBUG_OFF*/
|
||||
|
||||
|
|
Loading…
Reference in a new issue