summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.cc
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2004-10-21 18:44:40 +0400
committerunknown <konstantin@mysql.com>2004-10-21 18:44:40 +0400
commitc8ad5215eae17b892c2de145136539f0bf0492c5 (patch)
tree3c06a9f4e06fd4a071292b3d409c2140d5aa0654 /sql/sql_prepare.cc
parent0da47eae2491b53af11f0e06226de3d0052fc28a (diff)
parent506f648b3a104bf107ebe7a49bcf6b044682a7b8 (diff)
downloadmariadb-git-c8ad5215eae17b892c2de145136539f0bf0492c5.tar.gz
Manual merge.
sql/sql_class.h: Auto merged sql/sql_prepare.cc: Auto merged tests/client_test.c: Manual merge
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r--sql/sql_prepare.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 239ff13f261..12f526c5566 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1064,6 +1064,12 @@ static int mysql_test_select(Prepared_statement *stmt,
DBUG_RETURN(1);
#endif
+ if (!lex->result && !(lex->result= new (&stmt->mem_root) select_send))
+ {
+ send_error(thd);
+ goto err;
+ }
+
if (open_and_lock_tables(thd, tables))
{
send_error(thd);
@@ -1087,8 +1093,13 @@ static int mysql_test_select(Prepared_statement *stmt,
}
else
{
- if (send_prep_stmt(stmt, lex->select_lex.item_list.elements) ||
- thd->protocol_simple.send_fields(&lex->select_lex.item_list, 0)
+ List<Item> &fields= lex->select_lex.item_list;
+ /*
+ We can use lex->result as it should've been
+ prepared in unit->prepare call above.
+ */
+ if (send_prep_stmt(stmt, lex->result->field_count(fields)) ||
+ lex->result->send_fields(fields, 0)
#ifndef EMBEDDED_LIBRARY
|| net_flush(&thd->net)
#endif