~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table.h

  • Committer: Brian Aker
  • Date: 2008-08-18 20:57:01 UTC
  • mto: This revision was merged to the branch mainline in revision 352.
  • Revision ID: brian@tangent.org-20080818205701-rzeyd4qw4xj7wx7l
Refactoring of class Table

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#define DRIZZLED_TABLE_H
21
21
 
22
22
#include <storage/myisam/myisam.h>
 
23
#include <drizzled/order.h>
 
24
#include <drizzled/filesort_info.h>
23
25
 
24
 
class Item;                             /* Needed by ORDER */
 
26
class Item;                             /* Needed by order_st */
25
27
class Item_subselect;
26
28
class st_select_lex_unit;
27
29
class st_select_lex;
31
33
 
32
34
/*************************************************************************/
33
35
 
34
 
/* Order clause list element */
35
 
 
36
 
typedef struct st_order {
37
 
  struct st_order *next;
38
 
  Item   **item;                        /* Point at item in select fields */
39
 
  Item   *item_ptr;                     /* Storage for initial item */
40
 
  Item   **item_copy;                   /* For SPs; the original item ptr */
41
 
  int    counter;                       /* position in SELECT list, correct
42
 
                                           only if counter_used is true*/
43
 
  bool   asc;                           /* true if ascending */
44
 
  bool   free_me;                       /* true if item isn't shared  */
45
 
  bool   in_field_list;                 /* true if in select field list */
46
 
  bool   counter_used;                  /* parameter was counter of columns */
47
 
  Field  *field;                        /* If tmp-table group */
48
 
  char   *buff;                         /* If tmp-table group */
49
 
  table_map used, depend_map;
50
 
} ORDER;
51
 
 
52
36
enum tmp_table_type
53
37
{
54
38
  NO_TMP_TABLE, NON_TRANSACTIONAL_TMP_TABLE, TRANSACTIONAL_TMP_TABLE,
60
44
 
61
45
enum release_type { RELEASE_NORMAL, RELEASE_WAIT_FOR_DROP };
62
46
 
63
 
typedef struct st_filesort_info
64
 
{
65
 
  IO_CACHE *io_cache;           /* If sorted through filesort */
66
 
  uchar     **sort_keys;        /* Buffer for sorting keys */
67
 
  uchar     *buffpek;           /* Buffer for buffpek structures */
68
 
  uint      buffpek_len;        /* Max number of buffpeks in the buffer */
69
 
  uchar     *addon_buf;         /* Pointer to a buffer if sorted with fields */
70
 
  size_t    addon_length;       /* Length of the buffer */
71
 
  struct st_sort_addon_field *addon_field;     /* Pointer to the fields info */
72
 
  void    (*unpack)(struct st_sort_addon_field *, uchar *); /* To unpack back */
73
 
  uchar     *record_pointers;    /* If sorted in memory */
74
 
  ha_rows   found_records;      /* How many records in sort */
75
 
} FILESORT_INFO;
76
 
 
77
 
 
78
47
/*
79
48
  Values in this enum are used to indicate how a tables TIMESTAMP field
80
49
  should be treated. It can be set to the current timestamp on insert or
349
318
  INDEX_HINT_FORCE
350
319
};
351
320
 
 
321
typedef struct st_table_field_w_type
 
322
{
 
323
  LEX_STRING name;
 
324
  LEX_STRING type;
 
325
  LEX_STRING cset;
 
326
} TABLE_FIELD_W_TYPE;
 
327
 
352
328
bool create_myisam_from_heap(THD *thd, Table *table,
353
329
                             MI_COLUMNDEF *start_recinfo,
354
330
                             MI_COLUMNDEF **recinfo, 
389
365
  void free_tmp_table(THD *thd);
390
366
  bool open_tmp_table();
391
367
 
 
368
  bool table_check_intact(const uint table_f_count, const TABLE_FIELD_W_TYPE *table_def);
 
369
 
392
370
  /* See if this can be blown away */
393
371
  inline uint getDBStat () { return db_stat; }
394
372
  inline uint setDBStat () { return db_stat; }
433
411
  Field_timestamp *timestamp_field;
434
412
 
435
413
  TABLE_LIST *pos_in_table_list;/* Element referring to this table */
436
 
  ORDER         *group;
 
414
  order_st *group;
437
415
  const char    *alias;                   /* alias or table name */
438
416
  uchar         *null_flags;
439
417
  my_bitmap_map *bitmap_init_value;
559
537
 
560
538
  REGINFO reginfo;                      /* field connections */
561
539
  MEM_ROOT mem_root;
562
 
  FILESORT_INFO sort;
 
540
  filesort_info_st sort;
563
541
 
564
542
  bool fill_item_list(List<Item> *item_list) const;
565
543
  void reset_item_list(List<Item> *item_list) const;
955
933
  uint32_t in_use,locked;
956
934
} OPEN_TABLE_LIST;
957
935
 
958
 
typedef struct st_table_field_w_type
959
 
{
960
 
  LEX_STRING name;
961
 
  LEX_STRING type;
962
 
  LEX_STRING cset;
963
 
} TABLE_FIELD_W_TYPE;
964
 
 
965
 
 
966
 
bool
967
 
table_check_intact(Table *table, const uint table_f_count,
968
 
                   const TABLE_FIELD_W_TYPE *table_def);
 
936
 
969
937
 
970
938
static inline my_bitmap_map *tmp_use_all_columns(Table *table,
971
939
                                                 MY_BITMAP *bitmap)
982
950
  bitmap->bitmap= old;
983
951
}
984
952
 
985
 
/* The following is only needed for debugging */
986
 
 
987
 
static inline my_bitmap_map *dbug_tmp_use_all_columns(Table *table __attribute__((unused)),
988
 
                                                      MY_BITMAP *bitmap __attribute__((unused)))
989
 
{
990
 
  return 0;
991
 
}
992
 
 
993
 
static inline void dbug_tmp_restore_column_map(MY_BITMAP *bitmap __attribute__((unused)),
994
 
                                               my_bitmap_map *old __attribute__((unused)))
995
 
{
996
 
  return;
997
 
}
998
 
 
999
953
size_t max_row_length(Table *table, const uchar *data);
1000
954
 
1001
955
#endif /* DRIZZLED_TABLE_H */