• evgen@sunlight.local's avatar
    Fixed bug#16861: User defined variable can have a wrong value if a tmp table was · f17a536e
    evgen@sunlight.local authored
    used.
    
    Sorting by RAND() uses a temporary table in order to get a correct results.
    User defined variable was set during filling the temporary table and later
    on it is substituted for its value from the temporary table. Due to this
    it contains the last value stored in the temporary table.
    
    Now if the result_field is set for the Item_func_set_user_var object it 
    updates variable from the result_field value when being sent to a client.
    
    The Item_func_set_user_var::check() now accepts a use_result_field
    parameter. Depending on its value the result_field or the args[0] is used
    to get current value.
    f17a536e
sql_class.cc 58 KB