summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.cc
diff options
context:
space:
mode:
authorvenu@myvenu.com <>2003-03-04 14:22:30 -0800
committervenu@myvenu.com <>2003-03-04 14:22:30 -0800
commit1f88025066a80b653fd8e641059cbb417217355f (patch)
tree026475c1a7808d85de620315d6a529bc7fec9bd7 /sql/sql_prepare.cc
parent6a9273fa95f689c2326848cdfd2820358ff34823 (diff)
downloadmariadb-git-1f88025066a80b653fd8e641059cbb417217355f.tar.gz
Fix EXPLAIN bug with binary protocol
Added new client tests (EXPLAIN + DECIMAL conv)
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r--sql/sql_prepare.cc54
1 files changed, 31 insertions, 23 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 7639f32353c..2e5b60d5f3f 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -572,34 +572,42 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables,
if (open_and_lock_tables(thd, tables))
DBUG_RETURN(1);
-
- fix_tables_pointers(thd->lex.all_selects_list);
- if (!result && !(result= new select_send()))
+ if (lex->describe)
{
- delete select_lex->having;
- delete select_lex->where;
- send_error(thd, ER_OUT_OF_RESOURCES);
- DBUG_RETURN(1);
- }
+ if (!(result= new select_send()))
+ {
+ send_error(thd, ER_OUT_OF_RESOURCES);
+ DBUG_RETURN(1);
+ }
+ if (send_prep_stmt(stmt, 0) || send_item_params(stmt))
+ DBUG_RETURN(1);
+ }
+ else
+ {
+ fix_tables_pointers(thd->lex.all_selects_list);
+ if (!result && !(result= new select_send()))
+ {
+ delete select_lex->having;
+ delete select_lex->where;
+ send_error(thd, ER_OUT_OF_RESOURCES);
+ DBUG_RETURN(1);
+ }
- JOIN *join= new JOIN(thd, fields, select_options, result);
- thd->used_tables= 0; // Updated by setup_fields
+ JOIN *join= new JOIN(thd, fields, select_options, result);
+ thd->used_tables= 0; // Updated by setup_fields
- if (join->prepare(&select_lex->ref_pointer_array, tables,
- wild_num, conds, og_num, order, group, having, proc,
- select_lex, unit, 0, 0))
- DBUG_RETURN(1);
+ if (join->prepare(&select_lex->ref_pointer_array, tables,
+ wild_num, conds, og_num, order, group, having, proc,
+ select_lex, unit, 0, 0))
+ DBUG_RETURN(1);
- /*
- Currently return only column list info only, and we are not
- sending any info on where clause.
- */
- if (send_prep_stmt(stmt, fields.elements) ||
- thd->protocol_simple.send_fields(&fields, 0) ||
- send_item_params(stmt))
- DBUG_RETURN(1);
- join->cleanup(thd);
+ if (send_prep_stmt(stmt, fields.elements) ||
+ thd->protocol_simple.send_fields(&fields, 0) ||
+ send_item_params(stmt))
+ DBUG_RETURN(1);
+ join->cleanup(thd);
+ }
DBUG_RETURN(0);
}