~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_select.cc

  • Committer: Patrick Crews
  • Date: 2010-08-17 17:42:29 UTC
  • mfrom: (1711.1.24 build)
  • Revision ID: gleebix@gmail.com-20100817174229-e28p5025ndgkkxif
Rollup patch - optimizer fixes, mutex removal, client cleanup, translations update

Show diffs side-by-side

added added

removed removed

Lines of Context:
4264
4264
  outer join table.
4265
4265
  We can't remove tests that are made against columns which are stored
4266
4266
  in sorted order.
4267
 
*****************************************************************************/
4268
 
 
4269
 
/**
4270
4267
  @return
4271
 
    1 if right_item is used removable reference key on left_item
4272
 
*/
 
4268
    1 if right_item used is a removable reference key on left_item
 
4269
    0 otherwise.
 
4270
****************************************************************************/
4273
4271
bool test_if_ref(Item_field *left_item,Item *right_item)
4274
4272
{
4275
4273
  Field *field=left_item->field;
4470
4468
    }
4471
4469
 
4472
4470
    for (part=0 ; part < ref_parts ; part++,key_part++)
 
4471
    {
4473
4472
      if (field->eq(key_part->field) &&
4474
 
          !(key_part->key_part_flag & HA_PART_KEY_SEG))
 
4473
          !(key_part->key_part_flag & HA_PART_KEY_SEG) &&
 
4474
          //If field can be NULL, we should not remove this predicate, as
 
4475
          //it may lead to non-rejection of NULL values. 
 
4476
          !(field->real_maybe_null()))
 
4477
      {
4475
4478
        return table->reginfo.join_tab->ref.items[part];
 
4479
      }
 
4480
    }
4476
4481
  }
4477
4482
  return (Item*) 0;
4478
4483
}
5505
5510
  return(1);
5506
5511
}
5507
5512
 
5508
 
SORT_FIELD *make_unireg_sortorder(order_st *order, uint32_t *length, SORT_FIELD *sortorder)
 
5513
SortField *make_unireg_sortorder(order_st *order, uint32_t *length, SortField *sortorder)
5509
5514
{
5510
5515
  uint32_t count;
5511
 
  SORT_FIELD *sort,*pos;
 
5516
  SortField *sort,*pos;
5512
5517
 
5513
5518
  count=0;
5514
5519
  for (order_st *tmp = order; tmp; tmp=tmp->next)
5515
5520
    count++;
5516
5521
  if (!sortorder)
5517
 
    sortorder= (SORT_FIELD*) memory::sql_alloc(sizeof(SORT_FIELD) *
 
5522
    sortorder= (SortField*) memory::sql_alloc(sizeof(SortField) *
5518
5523
                                       (max(count, *length) + 1));
5519
5524
  pos= sort= sortorder;
5520
5525
 
6589
6594
void Select_Lex::print(Session *session, String *str, enum_query_type query_type)
6590
6595
{
6591
6596
  /* QQ: session may not be set for sub queries, but this should be fixed */
6592
 
  assert(session);
 
6597
  if(not session)
 
6598
    session= current_session;
 
6599
 
6593
6600
 
6594
6601
  str->append(STRING_WITH_LEN("select "));
6595
6602