~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table.h

  • Committer: Olaf van der Spek
  • Date: 2011-06-24 13:24:06 UTC
  • mto: This revision was merged to the branch mainline in revision 2349.
  • Revision ID: olafvdspek@gmail.com-20110624132406-xf8cq0hcel3kw2uj
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
/* Structs that defines the Table */
22
 
 
23
 
 
24
 
 
25
 
#ifndef DRIZZLED_TABLE_H
26
 
#define DRIZZLED_TABLE_H
 
21
#pragma once
27
22
 
28
23
#include <string>
29
24
#include <boost/dynamic_bitset.hpp>
30
25
 
31
 
#include "drizzled/order.h"
32
 
#include "drizzled/filesort_info.h"
33
 
#include "drizzled/natural_join_column.h"
34
 
#include "drizzled/field_iterator.h"
35
 
#include "drizzled/cursor.h"
36
 
#include "drizzled/lex_string.h"
37
 
#include "drizzled/table_list.h"
38
 
#include "drizzled/table/instance.h"
39
 
#include "drizzled/atomics.h"
40
 
#include "drizzled/query_id.h"
41
 
 
42
 
#include "drizzled/visibility.h"
43
 
 
44
 
namespace drizzled
45
 
{
46
 
 
47
 
class COND_EQUAL;
48
 
class Field_blob;
49
 
class Item;
50
 
class Item_subselect;
51
 
class SecurityContext;
52
 
class Select_Lex;
53
 
class Select_Lex_Unit;
54
 
class TableList;
55
 
namespace field { class Epoch; }
56
 
namespace plugin { class StorageEngine; }
57
 
 
58
 
typedef enum enum_table_category TABLE_CATEGORY;
59
 
typedef struct st_columndef MI_COLUMNDEF;
 
26
#include <drizzled/order.h>
 
27
#include <drizzled/filesort_info.h>
 
28
#include <drizzled/natural_join_column.h>
 
29
#include <drizzled/field_iterator.h>
 
30
#include <drizzled/cursor.h>
 
31
#include <drizzled/lex_string.h>
 
32
#include <drizzled/table/instance.h>
 
33
#include <drizzled/atomics.h>
 
34
 
 
35
#include <drizzled/visibility.h>
 
36
 
 
37
namespace drizzled {
60
38
 
61
39
/**
62
40
 * Class representing a set of records, either in a temporary, 
337
315
 
338
316
  void init_mem_root()
339
317
  {
340
 
    init_sql_alloc(&mem_root, TABLE_ALLOC_BLOCK_SIZE, 0);
 
318
    if (not mem_root.alloc_root_inited())
 
319
      mem_root.init(TABLE_ALLOC_BLOCK_SIZE);
341
320
  }
342
321
public:
343
 
  memory::Root *getMemRoot()
344
 
  {
345
 
    if (not mem_root.alloc_root_inited())
346
 
    {
347
 
      init_mem_root();
348
 
    }
349
 
 
350
 
    return &mem_root;
351
 
  }
352
 
 
353
 
  void *alloc_root(size_t arg)
354
 
  {
355
 
    if (not mem_root.alloc_root_inited())
356
 
    {
357
 
      init_mem_root();
358
 
    }
359
 
 
360
 
    return mem_root.alloc_root(arg);
361
 
  }
362
 
 
363
 
  char *strmake_root(const char *str_arg, size_t len_arg)
364
 
  {
365
 
    if (not mem_root.alloc_root_inited())
366
 
    {
367
 
      init_mem_root();
368
 
    }
369
 
 
370
 
    return mem_root.strmake_root(str_arg, len_arg);
 
322
  memory::Root& mem()
 
323
  {
 
324
    init_mem_root();
 
325
    return mem_root;
 
326
  }
 
327
 
 
328
  unsigned char* alloc(size_t arg)
 
329
  {
 
330
    init_mem_root();
 
331
    return mem_root.alloc(arg);
 
332
  }
 
333
 
 
334
  char* strmake(const char* str_arg, size_t len_arg)
 
335
  {
 
336
    init_mem_root();
 
337
    return mem_root.strmake(str_arg, len_arg);
371
338
  }
372
339
 
373
340
  filesort_info sort;
471
438
   * @retval
472
439
   *  true when out of memory
473
440
   */
474
 
  bool fill_item_list(List<Item> *item_list) const;
 
441
  void fill_item_list(List<Item>&) const;
475
442
  void clear_column_bitmaps(void);
476
443
  void prepare_for_position(void);
477
444
  void mark_columns_used_by_index_no_reset(uint32_t index, boost::dynamic_bitset<>& bitmap);
500
467
  }
501
468
 
502
469
  /* Both of the below should go away once we can move this bit to the field objects */
503
 
  inline bool isReadSet(uint32_t index)
 
470
  inline bool isReadSet(uint32_t index) const
504
471
  {
505
472
    return read_set->test(index);
506
473
  }
810
777
    List<LEX_STRING> referenced_fields;
811
778
};
812
779
 
813
 
class TableList;
814
 
 
815
780
#define JOIN_TYPE_LEFT  1
816
781
#define JOIN_TYPE_RIGHT 2
817
782
 
818
 
struct st_lex;
819
 
class select_union;
820
 
class Tmp_Table_Param;
821
 
 
822
783
void free_blobs(Table *table);
823
784
int set_zone(int nr,int min_zone,int max_zone);
824
785
uint32_t convert_period_to_month(uint32_t period);
826
787
 
827
788
int test_if_number(char *str,int *res,bool allow_wildcards);
828
789
void change_byte(unsigned char *,uint,char,char);
829
 
 
830
 
namespace optimizer { class SqlSelect; }
831
 
 
832
790
void change_double_for_sort(double nr,unsigned char *to);
833
791
int get_quick_record(optimizer::SqlSelect *select);
834
792
 
835
793
void find_date(char *pos,uint32_t *vek,uint32_t flag);
836
 
TYPELIB *convert_strings_to_array_type(char * *typelibs, char * *end);
837
 
TYPELIB *typelib(memory::Root *mem_root, List<String> &strings);
 
794
TYPELIB* convert_strings_to_array_type(char** typelibs, char** end);
 
795
TYPELIB* typelib(memory::Root&, List<String>&);
838
796
ulong get_form_pos(int file, unsigned char *head, TYPELIB *save_names);
839
797
void append_unescaped(String *res, const char *pos, uint32_t length);
840
798
 
841
 
DRIZZLED_API int rename_file_ext(const char * from,const char * to,const char * ext);
842
799
bool check_column_name(const char *name);
843
 
bool check_db_name(Session *session, identifier::Schema &schema);
844
800
bool check_table_name(const char *name, uint32_t length);
845
801
 
846
802
} /* namespace drizzled */
847
803
 
848
 
#include "drizzled/table/singular.h"
849
 
#include "drizzled/table/concurrent.h"
 
804
#include <drizzled/table/singular.h>
 
805
#include <drizzled/table/concurrent.h>
850
806
 
851
 
#endif /* DRIZZLED_TABLE_H */