List:Commits« Previous MessageNext Message »
From:msvensson Date:September 7 2006 4:44pm
Subject:bk commit into 5.0 tree (msvensson:1.2232) BUG#17039
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-09-07 16:44:18+02:00, msvensson@neptunus.(none) +2 -0
  Bug#17039 Cursor with procedure crashes client
   - Change 'get_unit_column_type" to return the field list for the procedure

  sql/sql_union.cc@stripped, 2006-09-07 16:44:13+02:00, msvensson@neptunus.(none) +13 -2
    Change 'get_unit_column_type' to return the procedure field list if this is the
execution of a procedure.

  tests/mysql_client_test.c@stripped, 2006-09-07 16:44:13+02:00, msvensson@neptunus.(none)
+14 -0
    Add test case for using "procedure" in cursor.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	msvensson
# Host:	neptunus.(none)
# Root:	/home/msvensson/mysql/bug17039/my50-bug17039

--- 1.132/sql/sql_union.cc	2006-09-07 16:44:26 +02:00
+++ 1.133/sql/sql_union.cc	2006-09-07 16:44:26 +02:00
@@ -689,7 +689,17 @@ bool st_select_lex_unit::change_result(s
 
 List<Item> *st_select_lex_unit::get_unit_column_types()
 {
-  bool is_union= test(first_select()->next_select());
+  SELECT_LEX *sl= first_select();
+  bool is_union= test(sl->next_select());
+  bool is_procedure= test(sl->join->procedure);
+
+  if (is_procedure)
+  {
+    /* Types for "SELECT * FROM t1 procedure analyse()"
+       are generated during execute */
+    return &sl->join->procedure_fields_list;
+  }
+
 
   if (is_union)
   {
@@ -697,7 +707,8 @@ List<Item> *st_select_lex_unit::get_unit
     /* Types are generated during prepare */
     return &types;
   }
-  return &first_select()->item_list;
+
+  return &sl->item_list;
 }
 
 bool st_select_lex::cleanup()

--- 1.194/tests/mysql_client_test.c	2006-09-07 16:44:26 +02:00
+++ 1.195/tests/mysql_client_test.c	2006-09-07 16:44:26 +02:00
@@ -11931,6 +11931,19 @@ static void test_cursors_with_union()
   fetch_n(queries, sizeof(queries)/sizeof(*queries), USE_STORE_RESULT);
 }
 
+
+static void test_cursors_with_procedure()
+{
+  const char *queries[]=
+  {
+    "SELECT * FROM t1 procedure analyse()"
+  };
+  myheader("test_cursors_with_procedure");
+  fetch_n(queries, sizeof(queries)/sizeof(*queries), USE_ROW_BY_ROW_FETCH);
+  fetch_n(queries, sizeof(queries)/sizeof(*queries), USE_STORE_RESULT);
+}
+
+
 /*
   Altough mysql_create_db(), mysql_rm_db() are deprecated since 4.0 they
   should not crash server and should not hang in case of errors.
@@ -15297,6 +15310,7 @@ static struct my_tests_st my_tests[]= {
   { "test_view_insert_fields", test_view_insert_fields },
   { "test_basic_cursors", test_basic_cursors },
   { "test_cursors_with_union", test_cursors_with_union },
+  { "test_cursors_with_procedure", test_cursors_with_procedure },
   { "test_truncation", test_truncation },
   { "test_truncation_option", test_truncation_option },
   { "test_client_character_set", test_client_character_set },
Thread
bk commit into 5.0 tree (msvensson:1.2232) BUG#17039msvensson7 Sep