~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/handler_structs.h

  • Committer: Monty Taylor
  • Date: 2009-03-08 23:45:12 UTC
  • mto: (923.2.1 mordred)
  • mto: This revision was merged to the branch mainline in revision 921.
  • Revision ID: mordred@inaugust.com-20090308234512-tqkygxtu1iaig23s
Removed C99 isnan() usage, which allows us to remove the util/math.{cc,h} workarounds. Yay for standards!

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
20
20
#ifndef DRIZZLED_HANDLER_STRUCTS_H
21
21
#define DRIZZLED_HANDLER_STRUCTS_H
22
22
 
23
 
#if TIME_WITH_SYS_TIME
24
 
# include <sys/time.h>
25
 
# include <time.h>
26
 
#else
27
 
# if HAVE_SYS_TIME_H
28
 
#  include <sys/time.h>
29
 
# else
30
 
#  include <time.h>
31
 
# endif
32
 
#endif
 
23
#include <stdint.h>
 
24
#include <time.h>
33
25
 
34
26
#include <drizzled/base.h>
 
27
#include <drizzled/structs.h>
35
28
#include <drizzled/definitions.h>
36
29
#include <drizzled/lex_string.h>
37
 
#include <drizzled/structs.h>
38
 
 
39
 
namespace drizzled
40
 
{
41
 
 
42
 
struct charset_info_st;
43
 
 
44
 
namespace plugin
45
 
{
46
 
class StorageEngine;
47
 
}
 
30
 
 
31
class Ha_trx_info;
 
32
struct handlerton;
 
33
struct st_key;
 
34
typedef struct st_key KEY;
 
35
struct st_key_cache;
 
36
typedef struct st_key_cache KEY_CACHE;
 
37
 
 
38
struct Session_TRANS
 
39
{
 
40
  Session_TRANS() {};
 
41
 
 
42
  /* true is not all entries in the ht[] support 2pc */
 
43
  bool        no_2pc;
 
44
  /* storage engines that registered in this transaction */
 
45
  Ha_trx_info *ha_list;
 
46
  /*
 
47
    The purpose of this flag is to keep track of non-transactional
 
48
    tables that were modified in scope of:
 
49
    - transaction, when the variable is a member of
 
50
    Session::transaction.all
 
51
    - top-level statement or sub-statement, when the variable is a
 
52
    member of Session::transaction.stmt
 
53
    This member has the following life cycle:
 
54
    * stmt.modified_non_trans_table is used to keep track of
 
55
    modified non-transactional tables of top-level statements. At
 
56
    the end of the previous statement and at the beginning of the session,
 
57
    it is reset to false.  If such functions
 
58
    as mysql_insert, mysql_update, mysql_delete etc modify a
 
59
    non-transactional table, they set this flag to true.  At the
 
60
    end of the statement, the value of stmt.modified_non_trans_table
 
61
    is merged with all.modified_non_trans_table and gets reset.
 
62
    * all.modified_non_trans_table is reset at the end of transaction
 
63
 
 
64
    * Since we do not have a dedicated context for execution of a
 
65
    sub-statement, to keep track of non-transactional changes in a
 
66
    sub-statement, we re-use stmt.modified_non_trans_table.
 
67
    At entrance into a sub-statement, a copy of the value of
 
68
    stmt.modified_non_trans_table (containing the changes of the
 
69
    outer statement) is saved on stack. Then
 
70
    stmt.modified_non_trans_table is reset to false and the
 
71
    substatement is executed. Then the new value is merged with the
 
72
    saved value.
 
73
  */
 
74
  bool modified_non_trans_table;
 
75
 
 
76
  void reset() { no_2pc= false; modified_non_trans_table= false; }
 
77
};
 
78
 
 
79
typedef struct {
 
80
  uint64_t data_file_length;
 
81
  uint64_t max_data_file_length;
 
82
  uint64_t index_file_length;
 
83
  uint64_t delete_length;
 
84
  ha_rows records;
 
85
  uint32_t mean_rec_length;
 
86
  time_t create_time;
 
87
  time_t check_time;
 
88
  time_t update_time;
 
89
  uint64_t check_sum;
 
90
} PARTITION_INFO;
48
91
 
49
92
typedef struct st_ha_create_information
50
93
{
51
 
  const charset_info_st *table_charset, *default_table_charset;
 
94
  const CHARSET_INFO *table_charset, *default_table_charset;
 
95
  LEX_STRING connect_string;
 
96
  LEX_STRING comment;
 
97
  const char *data_file_name, *index_file_name;
52
98
  const char *alias;
 
99
  uint64_t max_rows,min_rows;
53
100
  uint64_t auto_increment_value;
54
101
  uint32_t table_options;
 
102
  uint32_t avg_row_length;
55
103
  uint32_t used_fields;
56
 
  plugin::StorageEngine *db_type;
 
104
  uint32_t key_block_size;
 
105
  uint32_t block_size;
 
106
  handlerton *db_type;
 
107
  enum row_type row_type;
 
108
  uint32_t null_bits;                       /* NULL bits at start of record */
 
109
  uint32_t options;                         /* OR of HA_CREATE_ options */
 
110
  uint32_t extra_size;                      /* length of extra data segment */
57
111
  bool table_existed;                   /* 1 in create if table existed */
58
 
 
59
 
  st_ha_create_information() :
60
 
    table_charset(0),
61
 
    default_table_charset(0),
62
 
    alias(0),
63
 
    auto_increment_value(0),
64
 
    table_options(0),
65
 
    used_fields(0),
66
 
    db_type(0),
67
 
    table_existed(0)
68
 
  { }
 
112
  bool varchar;                         /* 1 if table has a VARCHAR */
 
113
  enum ha_choice page_checksum;         /* If we have page_checksums */
69
114
} HA_CREATE_INFO;
70
115
 
71
116
typedef struct st_ha_alter_information
72
117
{
73
 
  KeyInfo  *key_info_buffer;
 
118
  KEY  *key_info_buffer;
74
119
  uint32_t key_count;
75
120
  uint32_t index_drop_count;
76
121
  uint32_t *index_drop_buffer;
77
122
  uint32_t index_add_count;
78
123
  uint32_t *index_add_buffer;
79
124
  void *data;
80
 
 
81
 
  st_ha_alter_information() :
82
 
    key_info_buffer(0),
83
 
    key_count(0),
84
 
    index_drop_count(0),
85
 
    index_drop_buffer(0),
86
 
    index_add_count(0),
87
 
    index_add_buffer(0),
88
 
    data(0)
89
 
  { }
90
 
 
91
125
} HA_ALTER_INFO;
92
126
 
93
127
 
94
 
typedef struct key_create_information_st
 
128
typedef struct st_key_create_information
95
129
{
96
130
  enum ha_key_alg algorithm;
97
131
  uint32_t block_size;
 
132
  LEX_STRING parser_name;
98
133
  LEX_STRING comment;
99
134
} KEY_CREATE_INFO;
100
135
 
102
137
typedef struct st_ha_check_opt
103
138
{
104
139
  st_ha_check_opt() {}                        /* Remove gcc warning */
 
140
  uint32_t flags;       /* myisam layer flags (e.g. for myisamchk) */
 
141
  /* Just rebuild based on the defintion of the table */
 
142
  bool use_frm;
 
143
  /* new key cache when changing key cache */
 
144
  KEY_CACHE *key_cache;
 
145
  void init();
105
146
} HA_CHECK_OPT;
106
147
 
107
148
 
137
178
  uint32_t (*next) (range_seq_t seq, KEY_MULTI_RANGE *range);
138
179
} RANGE_SEQ_IF;
139
180
 
140
 
} /* namespace drizzled */
 
181
/*
 
182
  This is a buffer area that the handler can use to store rows.
 
183
  'end_of_used_area' should be kept updated after calls to
 
184
  read-functions so that other parts of the code can use the
 
185
  remaining area (until next read calls is issued).
 
186
*/
 
187
 
 
188
typedef struct st_handler_buffer
 
189
{
 
190
  unsigned char *buffer;         /* Buffer one can start using */
 
191
  unsigned char *buffer_end;     /* End of buffer */
 
192
  unsigned char *end_of_used_area;     /* End of area that was used by handler */
 
193
} HANDLER_BUFFER;
141
194
 
142
195
#endif /* DRIZZLED_HANDLER_STRUCTS_H */