~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_select.cc

  • Committer: Brian Aker
  • Date: 2009-07-11 19:23:04 UTC
  • mfrom: (1089.1.14 merge)
  • Revision ID: brian@gaz-20090711192304-ootijyl5yf9jq9kd
Merge Brian

Show diffs side-by-side

added added

removed removed

Lines of Context:
2210
2210
      1. update_ref_and_keys() accumulates info about null-rejecting
2211
2211
         predicates in in KEY_FIELD::null_rejecting
2212
2212
      1.1 add_key_part saves these to KeyUse.
2213
 
      2. create_ref_for_key copies them to TABLE_REF.
 
2213
      2. create_ref_for_key copies them to table_reference_st.
2214
2214
      3. add_not_null_conds adds "x IS NOT NULL" to join_tab->select_cond of
2215
2215
         appropiate JoinTable members.
2216
2216
*/
4690
4690
  @return
4691
4691
    return one of enum_nested_loop_state, except NESTED_LOOP_NO_MORE_ROWS.
4692
4692
*/
4693
 
enum_nested_loop_state sub_select(JOIN *join,JoinTable *join_tab,bool end_of_records)
 
4693
enum_nested_loop_state sub_select(JOIN *join, JoinTable *join_tab, bool end_of_records)
4694
4694
{
4695
4695
  join_tab->table->null_row=0;
4696
4696
  if (end_of_records)
4702
4702
 
4703
4703
  if (join_tab->flush_weedout_table)
4704
4704
  {
4705
 
    do_sj_reset(join_tab->flush_weedout_table);
 
4705
    join_tab->flush_weedout_table->reset();
4706
4706
  }
4707
4707
 
4708
4708
  if (join->resume_nested_loop)
4756
4756
  return rc;
4757
4757
}
4758
4758
 
4759
 
/*
4760
 
  SemiJoinDuplicateElimination: Reset the temporary table
4761
 
*/
4762
 
int do_sj_reset(SemiJoinTable *sj_tbl)
4763
 
{
4764
 
  if (sj_tbl->tmp_table)
4765
 
    return sj_tbl->tmp_table->file->ha_delete_all_rows();
4766
 
  return 0;
4767
 
}
4768
 
 
4769
4759
int safe_index_read(JoinTable *tab)
4770
4760
{
4771
4761
  int error;
6723
6713
  return(sort);
6724
6714
}
6725
6715
 
6726
 
void read_cached_record(JoinTable *tab)
6727
 
{
6728
 
  unsigned char *pos;
6729
 
  uint32_t length;
6730
 
  bool last_record;
6731
 
  CACHE_FIELD *copy,*end_field;
6732
 
 
6733
 
  last_record= tab->cache.record_nr++ == tab->cache.ptr_record;
6734
 
  pos= tab->cache.pos;
6735
 
  for (copy= tab->cache.field, end_field= copy+tab->cache.fields;
6736
 
       copy < end_field;
6737
 
       copy++)
6738
 
  {
6739
 
    if (copy->blob_field)
6740
 
    {
6741
 
      if (last_record)
6742
 
      {
6743
 
        copy->blob_field->set_image(pos, copy->length+sizeof(char*),
6744
 
                  copy->blob_field->charset());
6745
 
        pos+=copy->length+sizeof(char*);
6746
 
      }
6747
 
      else
6748
 
      {
6749
 
        copy->blob_field->set_ptr(pos, pos+copy->length);
6750
 
        pos+=copy->length+copy->blob_field->get_length();
6751
 
      }
6752
 
    }
6753
 
    else
6754
 
    {
6755
 
      if (copy->strip)
6756
 
      {
6757
 
        length= uint2korr(pos);
6758
 
        memcpy(copy->str, pos+2, length);
6759
 
        memset(copy->str+length, ' ', copy->length-length);
6760
 
        pos+= 2 + length;
6761
 
      }
6762
 
      else
6763
 
      {
6764
 
        memcpy(copy->str,pos,copy->length);
6765
 
        pos+=copy->length;
6766
 
      }
6767
 
    }
6768
 
  }
6769
 
  tab->cache.pos=pos;
6770
 
  return;
6771
 
}
6772
 
 
6773
6716
/*
6774
6717
  eq_ref: Create the lookup key and check if it is the same as saved key
6775
6718
 
6808
6751
    != 0;
6809
6752
}
6810
6753
 
6811
 
bool cp_buffer_from_ref(Session *session, TABLE_REF *ref)
 
6754
bool cp_buffer_from_ref(Session *session, table_reference_st *ref)
6812
6755
{
6813
6756
  enum enum_check_fields save_count_cuted_fields= session->count_cuted_fields;
6814
6757
  session->count_cuted_fields= CHECK_FIELD_IGNORE;