00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #pragma once
00033
00034 namespace drizzled {
00035
00036 class FileSort
00037 {
00038 Session &_session;
00039
00040 uint32_t sortlength(SortField *sortorder, uint32_t s_length, bool *multi_byte_charset);
00041 sort_addon_field *get_addon_fields(Field **ptabfield, uint32_t sortlength, uint32_t *plength);
00042 ha_rows find_all_keys(SortParam *param,
00043 optimizer::SqlSelect *select,
00044 unsigned char **sort_keys,
00045 internal::io_cache_st *buffpek_pointers,
00046 internal::io_cache_st *tempfile, internal::io_cache_st *indexfile);
00047
00048 int merge_buffers(SortParam *param,internal::io_cache_st *from_file,
00049 internal::io_cache_st *to_file, unsigned char *sort_buffer,
00050 buffpek *lastbuff,
00051 buffpek *Fb,
00052 buffpek *Tb,int flag);
00053
00054 int merge_index(SortParam *param,
00055 unsigned char *sort_buffer,
00056 buffpek *buffpek,
00057 uint32_t maxbuffer,
00058 internal::io_cache_st *tempfile,
00059 internal::io_cache_st *outfile);
00060
00061 int merge_many_buff(SortParam *param, unsigned char *sort_buffer,
00062 buffpek *buffpek,
00063 uint32_t *maxbuffer, internal::io_cache_st *t_file);
00064
00065 uint32_t read_to_buffer(internal::io_cache_st *fromfile, buffpek *buffpek,
00066 uint32_t sort_length);
00067
00068
00069
00070 public:
00071
00072 FileSort(Session &arg);
00073
00074 Session &getSession()
00075 {
00076 return _session;
00077 }
00078
00079 ha_rows run(Table *table, SortField *sortorder, uint32_t s_length,
00080 optimizer::SqlSelect *select, ha_rows max_rows,
00081 bool sort_positions, ha_rows &examined_rows);
00082
00083 };
00084
00085 }
00086