~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_select.cc

merge innobase 1.0.9 build fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
#include "drizzled/index_hint.h"
52
52
#include "drizzled/records.h"
53
53
#include "drizzled/internal/iocache.h"
 
54
#include "drizzled/drizzled.h"
54
55
 
55
56
#include "drizzled/sql_union.h"
56
57
#include "drizzled/optimizer/key_field.h"
61
62
#include "drizzled/optimizer/quick_range_select.h"
62
63
#include "drizzled/optimizer/quick_ror_intersect_select.h"
63
64
 
 
65
#include "drizzled/filesort.h"
 
66
 
64
67
using namespace std;
65
68
 
66
69
namespace drizzled
1216
1219
  delete quick;
1217
1220
  quick= 0;
1218
1221
  if (cache.buff)
 
1222
  {
 
1223
    size_t size= cache.end - cache.buff;
 
1224
    global_join_buffer.sub(size);
1219
1225
    free(cache.buff);
 
1226
  }
1220
1227
  cache.buff= 0;
1221
1228
  limit= 0;
1222
1229
  if (table)
3140
3147
      rc= sub_select(join,join_tab,end_of_records);
3141
3148
    return rc;
3142
3149
  }
3143
 
  if (join->session->killed)            // If aborted by user
 
3150
  if (join->session->getKilled())               // If aborted by user
3144
3151
  {
3145
3152
    join->session->send_kill_message();
3146
3153
    return NESTED_LOOP_KILLED;
3951
3958
  Table *table=join->tmp_table;
3952
3959
  int     idx= -1;
3953
3960
 
3954
 
  if (join->session->killed)
 
3961
  if (join->session->getKilled())
3955
3962
  {                                             // Aborted by user
3956
3963
    join->session->send_kill_message();
3957
3964
    return NESTED_LOOP_KILLED;
5006
5013
    return(0);
5007
5014
  for (Order *ord= join->order; ord; ord= ord->next)
5008
5015
    length++;
5009
 
  if (!(join->sortorder=
5010
 
        make_unireg_sortorder(order, &length, join->sortorder)))
5011
 
    goto err;
 
5016
  if (!(join->sortorder= make_unireg_sortorder(order, &length, join->sortorder)))
 
5017
  {
 
5018
    return(-1);
 
5019
  }
5012
5020
 
5013
5021
  table->sort.io_cache= new internal::IO_CACHE;
5014
5022
  table->status=0;                              // May be wrong if quick_select
5043
5051
                                                                 &tab->ref,
5044
5052
                                                                 tab->found_records))))
5045
5053
      {
5046
 
        goto err;
 
5054
        return(-1);
5047
5055
      }
5048
5056
    }
5049
5057
  }
5050
5058
 
5051
5059
  if (table->getShare()->getType())
5052
5060
    table->cursor->info(HA_STATUS_VARIABLE);    // Get record count
5053
 
  table->sort.found_records=filesort(session, table,join->sortorder, length,
5054
 
                                     select, filesort_limit, 0,
5055
 
                                     &examined_rows);
 
5061
 
 
5062
  FileSort filesort(*session);
 
5063
  table->sort.found_records=filesort.run(table,join->sortorder, length,
 
5064
                                         select, filesort_limit, 0,
 
5065
                                         examined_rows);
5056
5066
  tab->records= table->sort.found_records;      // For SQL_CALC_ROWS
5057
5067
  if (select)
5058
5068
  {
5070
5080
    table->key_read=0;
5071
5081
    table->cursor->extra(HA_EXTRA_NO_KEYREAD);
5072
5082
  }
 
5083
 
5073
5084
  return(table->sort.found_records == HA_POS_ERROR);
5074
 
err:
5075
 
  return(-1);
5076
5085
}
5077
5086
 
5078
5087
int remove_dup_with_compare(Session *session, Table *table, Field **first_field, uint32_t offset, Item *having)
5090
5099
  error=cursor->rnd_next(record);
5091
5100
  for (;;)
5092
5101
  {
5093
 
    if (session->killed)
 
5102
    if (session->getKilled())
5094
5103
    {
5095
5104
      session->send_kill_message();
5096
5105
      error=0;
5208
5217
  for (;;)
5209
5218
  {
5210
5219
    unsigned char *org_key_pos;
5211
 
    if (session->killed)
 
5220
    if (session->getKilled())
5212
5221
    {
5213
5222
      session->send_kill_message();
5214
5223
      error=0;