drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
filesort.h
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2010 Brian Aker
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21/*
22 This is a "work in progress". The concept needs to be replicated throughout
23 the code, but we will start with baby steps for the moment. To not incur
24 cost until we are complete, for the moment it will do no allocation.
25
26 This is mainly here so that it can be used in the SE interface for
27 the time being.
28
29 This will replace Table_ident.
30 */
31
32#pragma once
33
34namespace drizzled {
35
36class FileSort
37{
38 Session &_session;
39
40 uint32_t sortlength(SortField *sortorder, uint32_t s_length, bool *multi_byte_charset);
41 sort_addon_field *get_addon_fields(Field **ptabfield, uint32_t sortlength, uint32_t *plength);
42 ha_rows find_all_keys(SortParam *param,
44 unsigned char **sort_keys,
45 internal::io_cache_st *buffpek_pointers,
46 internal::io_cache_st *tempfile, internal::io_cache_st *indexfile);
47
48 int merge_buffers(SortParam *param,internal::io_cache_st *from_file,
49 internal::io_cache_st *to_file, unsigned char *sort_buffer,
50 buffpek *lastbuff,
51 buffpek *Fb,
52 buffpek *Tb,int flag);
53
54 int merge_index(SortParam *param,
55 unsigned char *sort_buffer,
57 uint32_t maxbuffer,
58 internal::io_cache_st *tempfile,
59 internal::io_cache_st *outfile);
60
61 int merge_many_buff(SortParam *param, unsigned char *sort_buffer,
63 uint32_t *maxbuffer, internal::io_cache_st *t_file);
64
66 uint32_t sort_length);
67
68
69
70public:
71
72 FileSort(Session &arg);
73
74 Session &getSession()
75 {
76 return _session;
77 }
78
79 ha_rows run(Table *table, SortField *sortorder, uint32_t s_length,
80 optimizer::SqlSelect *select, ha_rows max_rows,
81 bool sort_positions, ha_rows &examined_rows);
82
83};
84
85} /* namespace drizzled */
86
sort_addon_field * get_addon_fields(Field **ptabfield, uint32_t sortlength, uint32_t *plength)
Definition filesort.cc:1543
uint32_t sortlength(SortField *sortorder, uint32_t s_length, bool *multi_byte_charset)
Definition filesort.cc:1440
uint32_t read_to_buffer(internal::io_cache_st *fromfile, buffpek *buffpek, uint32_t sort_length)
Definition filesort.cc:1129
ha_rows find_all_keys(SortParam *param, optimizer::SqlSelect *select, unsigned char **sort_keys, internal::io_cache_st *buffpek_pointers, internal::io_cache_st *tempfile, internal::io_cache_st *indexfile)
Definition filesort.cc:524
int merge_buffers(SortParam *param, internal::io_cache_st *from_file, internal::io_cache_st *to_file, unsigned char *sort_buffer, buffpek *lastbuff, buffpek *Fb, buffpek *Tb, int flag)
Definition filesort.cc:1186
ha_rows run(Table *table, SortField *sortorder, uint32_t s_length, optimizer::SqlSelect *select, ha_rows max_rows, bool sort_positions, ha_rows &examined_rows)
Definition filesort.cc:189
int merge_many_buff(SortParam *param, unsigned char *sort_buffer, buffpek *buffpek, uint32_t *maxbuffer, internal::io_cache_st *t_file)
Definition filesort.cc:1069
TODO: Rename this file - func.h is stupid.