• unknown's avatar
    Bug#15518 Reusing a stmt that has failed during prepare does not clear error · 7b965030
    unknown authored
     - Always reset error when calling mysql_stmt_prepare a second time
     - Set stmt->state to MYSQL_STMT_INIT_DONE before closing prepared stmt in server.
     - Add test to mysql_client_test
     - Remove mysql_stmt_close in mysqltest after each query
     - Close all open statements in mysqltest if disable_ps_protocol is called. 
    
    
    client/mysqltest.c:
      Don't close the statement after each query - reprepare it in next query.
      When "disable_ps_protocol" is issued make sure to close all open
      statements. Otherwise the test for @@max_prepared_statements fails. But we
      also get a test that the statements that are open can be closed and reopened
      in the middle of the tests.
    libmysql/libmysql.c:
      Reset the last error every time mysql_stmt_prepare is called.
      Set state to MYSQL_STMT_INIT_DONE befoe closing it in the server. That way
      we will always have right status regardless of wheter close fails or not.
    tests/mysql_client_test.c:
      Add testcase for bug15518, re-prepare a previously prepare statement that has failed
      to prepare. Test also when connection to server has been lost inbetween.
      Change all assert to DIE_UNLESS so we get printout of line and an error message
      if it fails.
    7b965030
libmysql.c 142 KB