~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/structs.h

  • Committer: Brian Aker
  • Date: 2008-07-28 18:01:38 UTC
  • Revision ID: brian@tangent.org-20080728180138-q2pxlq0qiapvqsdn
Remove YEAR field type

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems
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
 
/* The old structures from unireg */
22
 
 
23
 
#ifndef DRIZZLED_STRUCTS_H
24
 
#define DRIZZLED_STRUCTS_H
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
 
class Table;
32
 
class Field;
33
 
typedef struct st_io_cache IO_CACHE;
34
 
 
35
 
typedef struct st_keyfile_info {        /* used with ha_info() */
36
 
  unsigned char ref[MAX_REFLENGTH];             /* Pointer to current row */
37
 
  unsigned char dupp_ref[MAX_REFLENGTH];        /* Pointer to dupp row */
38
 
  uint32_t ref_length;                  /* Length of ref (1-8) */
39
 
  uint32_t block_size;                  /* index block size */
40
 
  int filenr;                           /* (uniq) filenr for table */
41
 
  ha_rows records;                      /* Records i datafilen */
42
 
  ha_rows deleted;                      /* Deleted records */
43
 
  uint64_t data_file_length;            /* Length off data file */
44
 
  uint64_t max_data_file_length;        /* Length off data file */
45
 
  uint64_t index_file_length;
46
 
  uint64_t max_index_file_length;
47
 
  uint64_t delete_length;               /* Free bytes */
48
 
  uint64_t auto_increment_value;
49
 
  int errkey,sortkey;                   /* Last errorkey and sorted by */
50
 
  time_t create_time;                   /* When table was created */
51
 
  time_t check_time;
52
 
  time_t update_time;
53
 
  uint64_t mean_rec_length;             /* physical reclength */
54
 
} KEYFILE_INFO;
55
 
 
56
 
 
57
 
typedef struct st_key_part_info {       /* Info about a key part */
58
 
  Field *field;
59
 
  unsigned int  offset;                         /* offset in record (from 0) */
60
 
  unsigned int  null_offset;                    /* Offset to null_bit in record */
61
 
  /* Length of key part in bytes, excluding NULL flag and length bytes */
62
 
  uint16_t length;
63
 
  /*
64
 
    Number of bytes required to store the keypart value. This may be
65
 
    different from the "length" field as it also counts
66
 
     - possible NULL-flag byte (see HA_KEY_NULL_LENGTH) [if null_bit != 0,
67
 
       the first byte stored at offset is 1 if null, 0 if non-null; the
68
 
       actual value is stored from offset+1].
69
 
     - possible HA_KEY_BLOB_LENGTH bytes needed to store actual value length.
70
 
  */
71
 
  uint16_t store_length;
72
 
  uint16_t key_type;
73
 
  uint16_t fieldnr;                     /* Fieldnum in UNIREG (1,2,3,...) */
74
 
  uint16_t key_part_flag;                       /* 0 or HA_REVERSE_SORT */
75
 
  uint8_t type;
76
 
  uint8_t null_bit;                     /* Position to null_bit */
77
 
} KEY_PART_INFO ;
78
 
 
79
 
 
80
 
typedef struct st_key {
81
 
  unsigned int  key_length;             /* Tot length of key */
82
 
  enum  ha_key_alg algorithm;
83
 
  unsigned long flags;                  /* dupp key and pack flags */
84
 
  unsigned int key_parts;               /* How many key_parts */
85
 
  uint32_t  extra_length;
86
 
  unsigned int usable_key_parts;        /* Should normally be = key_parts */
87
 
  uint32_t  block_size;
88
 
  KEY_PART_INFO *key_part;
89
 
  char  *name;                          /* Name of key */
90
 
  /*
91
 
    Array of AVG(#records with the same field value) for 1st ... Nth key part.
92
 
    0 means 'not known'.
93
 
    For temporary heap tables this member is NULL.
94
 
  */
95
 
  ulong *rec_per_key;
96
 
  Table *table;
97
 
  LEX_STRING comment;
98
 
} KEY;
99
 
 
100
 
 
101
 
class JoinTable;
102
 
 
103
 
struct RegInfo {                /* Extra info about reg */
104
 
  JoinTable *join_tab;  /* Used by SELECT() */
105
 
  enum thr_lock_type lock_type;         /* How database is used */
106
 
  bool not_exists_optimize;
107
 
  bool impossible_range;
108
 
  RegInfo()
109
 
    : join_tab(NULL), lock_type(TL_UNLOCK),
110
 
      not_exists_optimize(false), impossible_range(false) {}
111
 
  void reset()
112
 
  {
113
 
    join_tab= NULL;
114
 
    lock_type= TL_UNLOCK;
115
 
    not_exists_optimize= false;
116
 
    impossible_range= false;
117
 
  }
118
 
};
119
 
 
120
 
struct st_read_record;                          /* For referense later */
121
 
class Session;
122
 
class Cursor;
123
 
namespace drizzled { namespace optimizer { class SqlSelect; } }
124
 
 
125
 
typedef struct st_read_record {                 /* Parameter to read_record */
126
 
  Table *table;                 /* Head-form */
127
 
  Cursor *cursor;
128
 
  Table **forms;                        /* head and ref forms */
129
 
  int (*read_record)(struct st_read_record *);
130
 
  Session *session;
131
 
  drizzled::optimizer::SqlSelect *select;
132
 
  uint32_t cache_records;
133
 
  uint32_t ref_length,struct_length,reclength,rec_cache_size,error_offset;
134
 
  uint32_t index;
135
 
  unsigned char *ref_pos;                               /* pointer to form->refpos */
136
 
  unsigned char *record;
137
 
  unsigned char *rec_buf;                /* to read field values  after filesort */
138
 
  unsigned char *cache,*cache_pos,*cache_end,*read_positions;
139
 
  IO_CACHE *io_cache;
140
 
  bool print_error, ignore_not_found_rows;
141
 
  JoinTable *do_insideout_scan;
142
 
} READ_RECORD;
143
 
 
144
 
extern const char *show_comp_option_name[];
145
 
 
146
 
typedef int *(*update_var)(Session *, struct drizzle_show_var *);
147
 
 
148
 
        /* Bits in form->status */
149
 
#define STATUS_NO_RECORD        (1+2)   /* Record isn't usably */
150
 
#define STATUS_GARBAGE          1
151
 
#define STATUS_NOT_FOUND        2       /* No record in database when needed */
152
 
#define STATUS_NO_PARENT        4       /* Parent record wasn't found */
153
 
#define STATUS_NOT_READ         8       /* Record isn't read */
154
 
#define STATUS_UPDATED          16      /* Record is updated by formula */
155
 
#define STATUS_NULL_ROW         32      /* table->null_row is set */
156
 
#define STATUS_DELETED          64
157
 
 
158
 
#endif /* DRIZZLED_STRUCTS_H */