[Commits] 9810d5e: Helper function for debugging.

Oleksandr Byelkin sanja at mariadb.com
Sun Sep 11 12:55:58 EEST 2016


revision-id: 9810d5ea132c028ac133ef19683d20b5bf005cab (mariadb-10.1.8-244-g9810d5e)
parent(s): 1168e2fa54d2b77b3b7310c43faef7edd2c4a8dc
committer: Oleksandr Byelkin
timestamp: 2016-09-11 11:55:57 +0200
message:

Helper function for debugging.

---
 sql/item.cc | 46 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 45 insertions(+), 1 deletion(-)

diff --git a/sql/item.cc b/sql/item.cc
index f79509f..3070dc8 100644
--- a/sql/item.cc
+++ b/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*/
 


More information about the commits mailing list