~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/structs.h

Merge Stewart's dead code removal

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
23
23
#ifndef DRIZZLED_STRUCTS_H
24
24
#define DRIZZLED_STRUCTS_H
25
25
 
26
 
#include "drizzled/base.h"
27
 
#include "drizzled/definitions.h"
28
 
#include "drizzled/lex_string.h"
29
 
#include "drizzled/thr_lock.h"
30
 
 
31
 
namespace drizzled
32
 
{
33
 
 
34
 
namespace internal
35
 
{
36
 
typedef struct st_io_cache IO_CACHE;
37
 
}
 
26
#include <drizzled/base.h>
 
27
#include <mysys/definitions.h>
 
28
#include <drizzled/lex_string.h>
38
29
 
39
30
class Table;
40
31
class Field;
41
 
 
42
 
class KeyPartInfo 
43
 
{       /* Info about a key part */
44
 
public:
 
32
typedef struct st_io_cache IO_CACHE;
 
33
 
 
34
typedef struct st_keyfile_info {        /* used with ha_info() */
 
35
  unsigned char ref[MAX_REFLENGTH];             /* Pointer to current row */
 
36
  unsigned char dupp_ref[MAX_REFLENGTH];        /* Pointer to dupp row */
 
37
  uint32_t ref_length;                  /* Length of ref (1-8) */
 
38
  uint32_t block_size;                  /* index block size */
 
39
  File filenr;                          /* (uniq) filenr for table */
 
40
  ha_rows records;                      /* Records i datafilen */
 
41
  ha_rows deleted;                      /* Deleted records */
 
42
  uint64_t data_file_length;            /* Length off data file */
 
43
  uint64_t max_data_file_length;        /* Length off data file */
 
44
  uint64_t index_file_length;
 
45
  uint64_t max_index_file_length;
 
46
  uint64_t delete_length;               /* Free bytes */
 
47
  uint64_t auto_increment_value;
 
48
  int errkey,sortkey;                   /* Last errorkey and sorted by */
 
49
  time_t create_time;                   /* When table was created */
 
50
  time_t check_time;
 
51
  time_t update_time;
 
52
  uint64_t mean_rec_length;             /* physical reclength */
 
53
} KEYFILE_INFO;
 
54
 
 
55
 
 
56
typedef struct st_key_part_info {       /* Info about a key part */
45
57
  Field *field;
46
 
  unsigned int  offset;                         /* offset in record (from 0) */
47
 
  unsigned int  null_offset;                    /* Offset to null_bit in record */
 
58
  uint  offset;                         /* offset in record (from 0) */
 
59
  uint  null_offset;                    /* Offset to null_bit in record */
48
60
  /* Length of key part in bytes, excluding NULL flag and length bytes */
49
61
  uint16_t length;
50
62
  /*
57
69
  */
58
70
  uint16_t store_length;
59
71
  uint16_t key_type;
60
 
private:
61
 
public:
62
 
  uint16_t getKeyType() const
63
 
  {
64
 
    return key_type;
65
 
  }
66
72
  uint16_t fieldnr;                     /* Fieldnum in UNIREG (1,2,3,...) */
67
73
  uint16_t key_part_flag;                       /* 0 or HA_REVERSE_SORT */
68
74
  uint8_t type;
69
75
  uint8_t null_bit;                     /* Position to null_bit */
70
 
};
71
 
 
72
 
 
73
 
class KeyInfo 
74
 
{
75
 
public:
76
 
  unsigned int  key_length;             /* Tot length of key */
 
76
} KEY_PART_INFO ;
 
77
 
 
78
 
 
79
typedef struct st_key {
 
80
  uint  key_length;                     /* Tot length of key */
77
81
  enum  ha_key_alg algorithm;
78
 
  unsigned long flags;                  /* dupp key and pack flags */
79
 
  unsigned int key_parts;               /* How many key_parts */
 
82
  ulong flags;                          /* dupp key and pack flags */
 
83
  uint  key_parts;                      /* How many key_parts */
80
84
  uint32_t  extra_length;
81
 
  unsigned int usable_key_parts;        /* Should normally be = key_parts */
 
85
  uint  usable_key_parts;               /* Should normally be = key_parts */
82
86
  uint32_t  block_size;
83
 
  KeyPartInfo *key_part;
 
87
  KEY_PART_INFO *key_part;
84
88
  char  *name;                          /* Name of key */
85
89
  /*
86
90
    Array of AVG(#records with the same field value) for 1st ... Nth key part.
90
94
  ulong *rec_per_key;
91
95
  Table *table;
92
96
  LEX_STRING comment;
93
 
};
 
97
} KEY;
94
98
 
95
99
 
96
100
class JoinTable;
97
101
 
98
 
class RegInfo 
99
 
{
100
 
public:         /* Extra info about reg */
 
102
struct RegInfo {                /* Extra info about reg */
101
103
  JoinTable *join_tab;  /* Used by SELECT() */
102
104
  enum thr_lock_type lock_type;         /* How database is used */
103
105
  bool not_exists_optimize;
114
116
  }
115
117
};
116
118
 
 
119
struct st_read_record;                          /* For referense later */
 
120
class SQL_SELECT;
117
121
class Session;
118
122
class Cursor;
119
 
namespace optimizer { class SqlSelect; }
120
 
 
121
 
typedef int *(*update_var)(Session *, struct drizzle_show_var *);
122
 
 
123
 
} /* namespace drizzled */
 
123
 
 
124
typedef struct st_read_record {                 /* Parameter to read_record */
 
125
  Table *table;                 /* Head-form */
 
126
  Cursor *file;
 
127
  Table **forms;                        /* head and ref forms */
 
128
  int (*read_record)(struct st_read_record *);
 
129
  Session *session;
 
130
  SQL_SELECT *select;
 
131
  uint32_t cache_records;
 
132
  uint32_t ref_length,struct_length,reclength,rec_cache_size,error_offset;
 
133
  uint32_t index;
 
134
  unsigned char *ref_pos;                               /* pointer to form->refpos */
 
135
  unsigned char *record;
 
136
  unsigned char *rec_buf;                /* to read field values  after filesort */
 
137
  unsigned char *cache,*cache_pos,*cache_end,*read_positions;
 
138
  IO_CACHE *io_cache;
 
139
  bool print_error, ignore_not_found_rows;
 
140
  JoinTable *do_insideout_scan;
 
141
} READ_RECORD;
 
142
 
 
143
extern const char *show_comp_option_name[];
 
144
 
 
145
typedef int *(*update_var)(Session *, struct st_mysql_show_var *);
124
146
 
125
147
        /* Bits in form->status */
126
148
#define STATUS_NO_RECORD        (1+2)   /* Record isn't usably */