• thek@adventure.(none)'s avatar
    Bug#26277 User variable returns one type in SELECT @v and other for CREATE as SELECT @v · 637f85ca
    thek@adventure.(none) authored
    - Adding variable m_cached_result_type to keep the variable type consistent
      during the execution of a statement.
    - Before each result set is returned to the client the description of each
      column is sent as meta data.
      Previously the result type for a column could change if the hash variable
      entry changed between statements. This caused the result set of the query
      to alternate column types in certain cases which is not supported by MySQL
      client-server protocol. Example:
      Previously this sequence:
        SET @A:=1;
        SELECT @A:="text", @A;
      would return "text", "text";
     
      After the change the SELECT returns "text", 0
      The reson for this is that previously the result set from 'SELECT @A;'
      would always be of the type STRING, whereas now the type of the variable
      is taken from the last SET statement. However, 'SELECT @A:="text"' will
      return type of STRING since the right side of the assignment is used.
    637f85ca
sp-vars.test 26.4 KB