• unknown's avatar
    Fix for bug #1500 "Server crash with mysql_prepare" · 00ddd4e5
    unknown authored
    We treat Item_param whose value is not set as non-const.
    This allows us to avoid use of Item_param's value (not yet existing) in 
    those fix_fields and fix_length_and_dec that do calculations if their 
    Items arguments are const. So we can call fix_fields for such items from
    mysql_prepare safely.
    
    
    sql/item.cc:
      Now Item_param is non-constant (const_item()==FALSE) until its value is set.
    sql/item.h:
      Added Item::const_during_execution() method which indicates constants that will be known 
      during execution phase (but they may be not known during preparing phase for example parameters 
      of prep. statements.)
      Made Item_param non-constant until its is value set, so its value won't be requested during 
      prepare statement step.
    sql/item_func.cc:
      Fulltext search AGAINST clause now allows prepared statement parameter as its argument.
      Removed duplicate used_tables_cache update in Item_func_match::fix_fields()
      (it is set during Item_func::fix_fields).
    tests/client_test.c:
      Added test for bug #1500 "Server crash with mysql_prepare"
    00ddd4e5
item.cc 47 KB