~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/opt_sum.cc

  • Committer: Mats Kindahl
  • Date: 2008-08-25 19:04:45 UTC
  • mfrom: (371 trunk)
  • mto: (489.1.2 codestyle)
  • mto: This revision was merged to the branch mainline in revision 372.
  • Revision ID: mats@mysql.com-20080825190445-xsby29pqsfrapuxd
Merging lp:~mkindahl/stdize-code with lp:drizzle

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
    #                   Multiplication of number of rows in all tables
75
75
*/
76
76
 
77
 
static uint64_t get_exact_record_count(TABLE_LIST *tables)
 
77
static uint64_t get_exact_record_count(TableList *tables)
78
78
{
79
79
  uint64_t count= 1;
80
 
  for (TABLE_LIST *tl= tables; tl; tl= tl->next_leaf)
 
80
  for (TableList *tl= tables; tl; tl= tl->next_leaf)
81
81
  {
82
82
    ha_rows tmp= tl->table->file->records();
83
83
    if ((tmp == HA_POS_ERROR))
109
109
    HA_ERR_... if a deadlock or a lock wait timeout happens, for example
110
110
*/
111
111
 
112
 
int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
 
112
int opt_sum_query(TableList *tables, List<Item> &all_fields,COND *conds)
113
113
{
114
114
  List_iterator_fast<Item> it(all_fields);
115
115
  int const_result= 1;
128
128
    Analyze outer join dependencies, and, if possible, compute the number
129
129
    of returned rows.
130
130
  */
131
 
  for (TABLE_LIST *tl= tables; tl; tl= tl->next_leaf)
 
131
  for (TableList *tl= tables; tl; tl= tl->next_leaf)
132
132
  {
133
 
    TABLE_LIST *embedded;
 
133
    TableList *embedded;
134
134
    for (embedded= tl ; embedded; embedded= embedded->embedding)
135
135
    {
136
136
      if (embedded->on_expr)
233
233
 
234
234
          ref.key_buff= key_buff;
235
235
          Item_field *item_field= (Item_field*) (expr->real_item());
236
 
          TABLE *table= item_field->field->table;
 
236
          Table *table= item_field->field->table;
237
237
 
238
238
          /* 
239
239
            Look for a partial key that can be used for optimization.
381
381
 
382
382
          ref.key_buff= key_buff;
383
383
          Item_field *item_field= (Item_field*) (expr->real_item());
384
 
          TABLE *table= item_field->field->table;
 
384
          Table *table= item_field->field->table;
385
385
 
386
386
          /* 
387
387
            Look for a partial key that can be used for optimization.
802
802
  if (!(field->flags & PART_KEY_FLAG))
803
803
    return 0;                                        // Not key field
804
804
 
805
 
  TABLE *table= field->table;
 
805
  Table *table= field->table;
806
806
  uint idx= 0;
807
807
 
808
808
  KEY *keyinfo,*keyinfo_end;
813
813
    KEY_PART_INFO *part,*part_end;
814
814
    key_part_map key_part_to_use= 0;
815
815
    /*
816
 
      Perform a check if index is not disabled by ALTER TABLE
 
816
      Perform a check if index is not disabled by ALTER Table
817
817
      or IGNORE INDEX.
818
818
    */
819
819
    if (!table->keys_in_use_for_query.is_set(idx))