• unknown's avatar
    Fix for Bug #3307 "FLUSH TABLES sometimes breaks prepared statement · ca25de03
    unknown authored
    table resolution".
    Added members to Item_ident for storing original db, table and field
    names since those that set later from Field have shorter life-time 
    than required by prep. stmt. So we need to restore original names in 
    Item_ident::cleanup(). Also now using special construnctor for creation
    of Item_field from Field object that ensures that table and field name 
    have big enough life-time.
    
    "Fix" for bug #2050 "10 to 1 performance drop with server 4.1.1"
    Clean ups in implementation of caching of field number in table.
    Added caching of table in which field is found in find_field_in_tables(). 
    
    
    sql/item.cc:
      Added members to Item_ident for storing original db, table and field
      names since those that set later from Field have shorter life-time 
      than required by prep. stmt. So we need to restore original names in 
      Item_ident::cleanup().
      Added Item_ident::cached_table for caching table there we found 
      our field.
      Added special constructor for creation of Item_field from Field object
      that ensures that table and field name have big enough life-time.
    sql/item.h:
      Added members to Item_ident for storing original db, table and field
      names since those that set later from Field have shorter life-time 
      than required by prep. stmt. So we need to restore original names in 
      Item_ident::cleanup().
      Changed type of Item_ident::cached_field_index from int to uint
      (and so NO_CACHED_FIELD_INDEX is UINT_MAX now) because we want to
      save one comparison in find_field_in_table().
      Added Item_ident::cached_table for caching table there we found 
      our field.
      Added special constructor for creation of Item_field from Field object
      that ensures that table and field name have big enough life-time.
    sql/mysql_priv.h:
      Changed type of cached_field_index_ptr from int* to uint*
      (and so NO_CACHED_FIELD_INDEX is UINT_MAX now) because we want to
      save one comparison in find_field_in_table().
    sql/sql_acl.cc:
      Changed type of find_field_in_table() paremeter to make it 
      faster.
    sql/sql_base.cc:
      find_field_in_table(): small optimization and soime clean ups in 
       caching of field index.
      find_field_in_tables(): added aggresive caching of table in which
       field is found in Item_ident::cached_table.
      insert_fields():
       using special construnctor for creation of Item_field from Field 
       object that ensures that table and field name have big enough life-time.
    ca25de03
mysql_priv.h 43.3 KB