Drizzled Public API Documentation

tmp_table_param.h

00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2008 Sun Microsystems, Inc.
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; version 2 of the License.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018  */
00019 
00020 
00021 #pragma once
00022 
00023 #include <plugin/myisam/myisam.h>
00024 
00025 namespace drizzled
00026 {
00027 
00028 class CopyField;
00029 
00030 /*
00031   Param to create temporary tables when doing SELECT:s
00032   NOTE
00033     This structure is copied using memcpy as a part of JOIN.
00034 */
00035 
00036 class Tmp_Table_Param :public memory::SqlAlloc
00037 {
00038 private:
00039   /* Prevent use of these (not safe because of lists and copy_field) */
00040   Tmp_Table_Param(const Tmp_Table_Param &);
00041   void operator=(Tmp_Table_Param &);
00042 
00043 public:
00044   KeyInfo *keyinfo;
00045   List<Item> copy_funcs;
00046   List<Item> save_copy_funcs;
00047   CopyField *copy_field, *copy_field_end;
00048   CopyField *save_copy_field, *save_copy_field_end;
00049   unsigned char     *group_buff;
00050   Item      **items_to_copy;      /* Fields in tmp table */
00051   MI_COLUMNDEF *recinfo,*start_recinfo;
00052   ha_rows end_write_records;
00053   uint32_t  field_count;
00054   uint32_t  sum_func_count;
00055   uint32_t  func_count;
00056   uint32_t  hidden_field_count;
00057   uint32_t  group_parts,group_length,group_null_parts;
00058   uint32_t  quick_group;
00059   bool using_indirect_summary_function;
00060   bool schema_table;
00061 
00062   /*
00063     True if GROUP BY and its aggregate functions are already computed
00064     by a table access method (e.g. by loose index scan). In this case
00065     query execution should not perform aggregation and should treat
00066     aggregate functions as normal functions.
00067   */
00068   bool precomputed_group_by;
00069 
00070   bool force_copy_fields;
00071 
00072   /* If >0 convert all blob fields to varchar(convert_blob_length) */
00073   uint32_t  convert_blob_length;
00074 
00075   const CHARSET_INFO *table_charset;
00076 
00077   Tmp_Table_Param() :
00078     keyinfo(0),
00079     copy_funcs(),
00080     save_copy_funcs(),
00081     copy_field(0),
00082     copy_field_end(0),
00083     save_copy_field(0),
00084     save_copy_field_end(0),
00085     group_buff(0),
00086     items_to_copy(0),
00087     recinfo(0),
00088     start_recinfo(0),
00089     end_write_records(0),
00090     field_count(0),
00091     sum_func_count(0),
00092     func_count(0),
00093     hidden_field_count(0),
00094     group_parts(0),
00095     group_length(0),
00096     group_null_parts(0),
00097     quick_group(0),
00098     using_indirect_summary_function(false),
00099     schema_table(false),
00100     precomputed_group_by(false),
00101     force_copy_fields(false),
00102     convert_blob_length(0),
00103     table_charset(0)
00104   {}
00105 
00106   ~Tmp_Table_Param()
00107   {
00108     cleanup();
00109   }
00110   void init(void);
00111   void cleanup(void);
00112 };
00113 
00114 } /* namespace drizzled */
00115