summaryrefslogtreecommitdiff
path: root/sql/sql_test.cc
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@sun.com>2010-01-28 12:10:57 +0100
committerTor Didriksen <tor.didriksen@sun.com>2010-01-28 12:10:57 +0100
commitc850371d3784438d008d3f5ea52ae1efe0fd8f4f (patch)
tree49b838157e3b73dad5e8292dfdaddb1f03787019 /sql/sql_test.cc
parentf546069d94ed0500461aa84ce8cfeb3391aee9ac (diff)
downloadmariadb-git-c850371d3784438d008d3f5ea52ae1efe0fd8f4f.tar.gz
Bug #50271: Debug output of JOIN structures is garbled
Diffstat (limited to 'sql/sql_test.cc')
-rw-r--r--sql/sql_test.cc24
1 files changed, 17 insertions, 7 deletions
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index eeb9a21b6f5..5de8301fd05 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -168,6 +168,21 @@ TEST_join(JOIN *join)
uint i,ref;
DBUG_ENTER("TEST_join");
+ /*
+ Assemble results of all the calls to full_name() first,
+ in order not to garble the tabular output below.
+ */
+ String ref_key_parts[MAX_TABLES];
+ for (i= 0; i < join->tables; i++)
+ {
+ JOIN_TAB *tab= join->join_tab + i;
+ for (ref= 0; ref < tab->ref.key_parts; ref++)
+ {
+ ref_key_parts[i].append(tab->ref.items[ref]->full_name());
+ ref_key_parts[i].append(" ");
+ }
+ }
+
DBUG_LOCK_FILE;
VOID(fputs("\nInfo about JOIN\n",DBUG_FILE));
for (i=0 ; i < join->tables ; i++)
@@ -199,13 +214,8 @@ TEST_join(JOIN *join)
}
if (tab->ref.key_parts)
{
- VOID(fputs(" refs: ",DBUG_FILE));
- for (ref=0 ; ref < tab->ref.key_parts ; ref++)
- {
- Item *item=tab->ref.items[ref];
- fprintf(DBUG_FILE,"%s ", item->full_name());
- }
- VOID(fputc('\n',DBUG_FILE));
+ fprintf(DBUG_FILE,
+ " refs: %s\n", ref_key_parts[i].ptr());
}
}
DBUG_UNLOCK_FILE;