~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/varstring.h

  • Committer: Prafulla Tekawade
  • Date: 2010-07-18 03:36:32 UTC
  • mto: (1662.1.4 rollup)
  • mto: This revision was merged to the branch mainline in revision 1664.
  • Revision ID: prafulla_t@users.sourceforge.net-20100718033632-p7q6qtgliqbhe38p
Fix for Bug 592444

There were two problems:
o. In greedy_search optimizer method, best_extension_by_limited search
   maintains join embedding(nestedness) of tables added so far, so that 
   correct(valid)  join order is selected
   These are requirements from nested outer join executioner.
   The problem was, embedding_map was not correctly updated when a table 
   is added to optimal plan outside best_extension_by_limited search, 
   by greedy_search method. We need to update join->cur_embedding_map
   correctly here so that execution plan for other tables get
   generated.
   Invoked checked_interleaving_with_nj from greedy_search on the
   best_table selected. Fixed its prototype to take only one JoinTab
   This is same as mysql 5.1 source tree.
o. The other problem was, join->cur_embedding_map was not restored correctly
   when a table is added to the optimal plan to reflect the current embedding 
   map. 
   Taken good documented method restore_prev_nj_state which restores 
   cur_embedding_map from mysql 5.1 source tree and modified it for drizzled 
   code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
    length_bytes.
42
42
  */
43
43
  static const uint32_t MAX_SIZE;
44
 
private:
45
44
  /* Store number of bytes used to store length (1 or 2) */
46
45
  uint32_t length_bytes;
47
 
public:
48
46
  Field_varstring(unsigned char *ptr_arg,
49
47
                  uint32_t len_arg,
50
48
                  uint32_t length_bytes_arg,
51
49
                  unsigned char *null_ptr_arg,
52
50
                  unsigned char null_bit_arg,
53
51
                  const char *field_name_arg,
 
52
                  TableShare *share,
54
53
                  const CHARSET_INFO * const cs);
55
54
  Field_varstring(uint32_t len_arg,
56
55
                  bool maybe_null_arg,
57
56
                  const char *field_name_arg,
 
57
                  TableShare *share,
58
58
                  const CHARSET_INFO * const cs);
59
59
 
60
60
  enum_field_types type() const { return DRIZZLE_TYPE_VARCHAR; }
62
62
  bool zero_pack() const { return 0; }
63
63
  int  reset(void) { memset(ptr, 0, field_length+length_bytes); return 0; }
64
64
  uint32_t pack_length() const { return (uint32_t) field_length+length_bytes; }
65
 
  uint32_t pack_length_no_ptr() const { return length_bytes; }
66
65
  uint32_t key_length() const { return (uint32_t) field_length; }
67
66
  uint32_t sort_length() const
68
67
  {
69
68
    return (uint32_t) field_length + (field_charset == &my_charset_bin ?
70
 
                                      length_bytes : 0);
 
69
                                    length_bytes : 0);
71
70
  }
72
71
  int  store(const char *to,uint32_t length, const CHARSET_INFO * const charset);
73
72