• unknown's avatar
    A fix and test case for Bug#9478 "mysql_stmt_attr_set mysql_stmt_execute" · 2a8556f3
    unknown authored
    (crash on attempt to re-execute a statement with an open cursor) + 
    post-review fixes.
    
    
    include/errmsg.h:
      Add a special error message when we attempt to mysql_stmt_fetch
      from a statement which has no result set.
    libmysql/errmsg.c:
      Error message text for CR_NO_RESULT_SET
    libmysql/libmysql.c:
      Move the code which frees result sets on client and closes the cursor
      on server, resets long data state on client and server.
      This makes one function out of two (mysql_stmt_reset and
      mysql_stmt_free_result), thus aggregating all related reset work
      in one place.
    sql-common/client.c:
      Fix one place where we flushed the pending result set of a statement,
      but didn't set unbuffered_fetch_cancelled flag.
    sql/share/errmsg.txt:
      Fix format of ER_UNKNOWN_STMT_HANDLER error message (needs to
      be fixed separately in 4.1). Add two new error messages 
      for the case when we fetch from when there is no cursor
      and for the case when we attempt to execute a statement while there is
      a cursor.
    sql/sql_prepare.cc:
      Return error when we fetch while there is no open cursor and
      when we call execute while there is a pending cursor.
      Fix mysql_stmt_reset to close the open cursor if there is any.
    sql/sql_select.cc:
      free_items and free_root moved to Cursor::close().
    sql/sql_select.h:
      A comment added.
    tests/mysql_client_test.c:
      A test case for Bug#9478, test the case of mysql_stmt_reset
      called for client-side cached result set and for the case with open cursor.
      All strcpy replaced with strmov (review request).
    2a8556f3
sql_prepare.cc 65.6 KB