~eday/drizzle/eday-dev

« back to all changes in this revision

Viewing changes to drizzled/filesort.cc

  • Committer: Eric Day
  • Date: 2010-01-07 20:02:38 UTC
  • mfrom: (971.3.291 staging)
  • Revision ID: eday@oddments.org-20100107200238-uqw8v6kv9pl7nny5
Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
  Sorts a database
22
22
*/
23
23
 
24
 
#include "drizzled/server_includes.h"
 
24
#include "config.h"
 
25
 
 
26
#include <float.h>
 
27
#include <limits.h>
 
28
 
 
29
#include <queue>
 
30
#include <algorithm>
 
31
 
25
32
#include "drizzled/sql_sort.h"
26
33
#include "drizzled/error.h"
27
34
#include "drizzled/probes.h"
30
37
#include "drizzled/table_list.h"
31
38
#include "drizzled/optimizer/range.h"
32
39
#include "drizzled/records.h"
33
 
 
34
 
#include <queue>
35
 
#include <algorithm>
 
40
#include "drizzled/internal/iocache.h"
 
41
#include "drizzled/internal/my_sys.h"
 
42
#include "plugin/myisam/myisam.h"
36
43
 
37
44
using namespace std;
38
45
using namespace drizzled;
46
53
                                     unsigned char *buf);
47
54
 
48
55
static ha_rows find_all_keys(SORTPARAM *param,
49
 
                             optimizer::SQL_SELECT *select,
 
56
                             optimizer::SqlSelect *select,
50
57
                             unsigned char * *sort_keys, 
51
58
                             IO_CACHE *buffer_file,
52
59
                             IO_CACHE *tempfile,
107
114
*/
108
115
 
109
116
ha_rows filesort(Session *session, Table *table, SORT_FIELD *sortorder, uint32_t s_length,
110
 
                 optimizer::SQL_SELECT *select, ha_rows max_rows,
 
117
                 optimizer::SqlSelect *select, ha_rows max_rows,
111
118
                 bool sort_positions, ha_rows *examined_rows)
112
119
{
113
120
  int error;
134
141
 
135
142
  /*
136
143
    Don't use table->sort in filesort as it is also used by
137
 
    QUICK_INDEX_MERGE_SELECT. Work with a copy and put it back at the end
 
144
    QuickIndexMergeSelect. Work with a copy and put it back at the end
138
145
    when index_merge select has finished with it.
139
146
  */
140
147
  memcpy(&table_sort, &table->sort, sizeof(filesort_info_st));
452
459
*/
453
460
 
454
461
static ha_rows find_all_keys(SORTPARAM *param, 
455
 
                             optimizer::SQL_SELECT *select,
 
462
                             optimizer::SqlSelect *select,
456
463
                             unsigned char **sort_keys,
457
464
                             IO_CACHE *buffpek_pointers,
458
465
                             IO_CACHE *tempfile, IO_CACHE *indexfile)
527
534
      {
528
535
        if (my_b_read(indexfile,(unsigned char*) ref_pos,ref_length))
529
536
        {
530
 
          error= my_errno ? my_errno : -1;              /* Abort */
 
537
          error= errno ? errno : -1;            /* Abort */
531
538
          break;
532
539
        }
533
540
        error=file->rnd_pos(sort_form->record[0],next_pos);