• unknown's avatar
    Patch for BUG#30472: libmysql doesn't reset charset, · 7ec9d9b3
    unknown authored
    insert_id after succ. mysql_change_user() call.
    
    See also WL 4066.
      
    This bug reveals two problems:
      - the problem on the client side which was described originally;
      - the problem in protocol / the server side: connection context
        on client and server should be like after mysql_real_connect()
        and be consistent. The server however just resets character
        set variables to the global defaults.
    
    The fix seems to be as follows:
      - extend the protocol so that the client be able to send
        character set information in COM_CHANGE_USER command;
      - change the server so that it understands client character set
        in the command;
      - change the client:
        - reset character set to the default value (which has been
          read from the configuration);
        - send character set in COM_CHANGE_USER command.
    
    
    client/client_priv.h:
      Declare a function, used in libmysql.c and client.c.
    libmysql/libmysql.c:
      1. Reset character set on the client in mysql_change_user().
      2. Send character set to the server in COM_CHANGE_USER command.
    mysql-test/t/mysql_client_test.test:
      mysql_client_test.log is used by the test suite.
      
      Use mysql_client_test.out.log to collect mysql_client_test
      real output.
    sql/sql_parse.cc:
      Switch character set in COM_CHANGE_USER.
    tests/mysql_client_test.c:
      Test case for BUG#30472.
    7ec9d9b3
mysql_client_test.c 462 KB