~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/handler_structs.h

  • Committer: Brian Aker
  • Date: 2010-01-22 00:53:13 UTC
  • Revision ID: brian@gaz-20100122005313-jmizcbcdi1lt4tcx
Revert db patch.

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; version 2 of the License.
 
9
 *
 
10
 *  This program is distributed in the hope that it will be useful,
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *  GNU General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU General Public License
 
16
 *  along with this program; if not, write to the Free Software
 
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 */
 
19
 
 
20
#ifndef DRIZZLED_HANDLER_STRUCTS_H
 
21
#define DRIZZLED_HANDLER_STRUCTS_H
 
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
 
33
 
 
34
#include <drizzled/base.h>
 
35
#include <drizzled/structs.h>
 
36
#include <drizzled/definitions.h>
 
37
#include <drizzled/lex_string.h>
 
38
#include "drizzled/global_charset_info.h"
 
39
 
 
40
 
 
41
class Ha_trx_info;
 
42
struct st_key;
 
43
typedef struct st_key KEY;
 
44
struct st_key_cache;
 
45
typedef struct st_key_cache KEY_CACHE;
 
46
 
 
47
namespace drizzled
 
48
{
 
49
namespace plugin
 
50
{
 
51
class StorageEngine;
 
52
}
 
53
}
 
54
 
 
55
struct Session_TRANS
 
56
{
 
57
  Session_TRANS() {};
 
58
 
 
59
  /* true is not all entries in the engines[] support 2pc */
 
60
  bool        no_2pc;
 
61
  /* storage engines that registered in this transaction */
 
62
  Ha_trx_info *ha_list;
 
63
  /*
 
64
    The purpose of this flag is to keep track of non-transactional
 
65
    tables that were modified in scope of:
 
66
    - transaction, when the variable is a member of
 
67
    Session::transaction.all
 
68
    - top-level statement or sub-statement, when the variable is a
 
69
    member of Session::transaction.stmt
 
70
    This member has the following life cycle:
 
71
    * stmt.modified_non_trans_table is used to keep track of
 
72
    modified non-transactional tables of top-level statements. At
 
73
    the end of the previous statement and at the beginning of the session,
 
74
    it is reset to false.  If such functions
 
75
    as mysql_insert, mysql_update, mysql_delete etc modify a
 
76
    non-transactional table, they set this flag to true.  At the
 
77
    end of the statement, the value of stmt.modified_non_trans_table
 
78
    is merged with all.modified_non_trans_table and gets reset.
 
79
    * all.modified_non_trans_table is reset at the end of transaction
 
80
 
 
81
    * Since we do not have a dedicated context for execution of a
 
82
    sub-statement, to keep track of non-transactional changes in a
 
83
    sub-statement, we re-use stmt.modified_non_trans_table.
 
84
    At entrance into a sub-statement, a copy of the value of
 
85
    stmt.modified_non_trans_table (containing the changes of the
 
86
    outer statement) is saved on stack. Then
 
87
    stmt.modified_non_trans_table is reset to false and the
 
88
    substatement is executed. Then the new value is merged with the
 
89
    saved value.
 
90
  */
 
91
  bool modified_non_trans_table;
 
92
 
 
93
  void reset() { no_2pc= false; modified_non_trans_table= false; }
 
94
};
 
95
 
 
96
typedef struct st_ha_create_information
 
97
{
 
98
  const CHARSET_INFO *table_charset, *default_table_charset;
 
99
  const char *alias;
 
100
  uint64_t auto_increment_value;
 
101
  uint32_t table_options;
 
102
  uint32_t used_fields;
 
103
  enum row_type row_type;
 
104
  drizzled::plugin::StorageEngine *db_type;
 
105
  bool table_existed;                   /* 1 in create if table existed */
 
106
} HA_CREATE_INFO;
 
107
 
 
108
typedef struct st_ha_alter_information
 
109
{
 
110
  KEY  *key_info_buffer;
 
111
  uint32_t key_count;
 
112
  uint32_t index_drop_count;
 
113
  uint32_t *index_drop_buffer;
 
114
  uint32_t index_add_count;
 
115
  uint32_t *index_add_buffer;
 
116
  void *data;
 
117
} HA_ALTER_INFO;
 
118
 
 
119
 
 
120
typedef struct st_key_create_information
 
121
{
 
122
  enum ha_key_alg algorithm;
 
123
  uint32_t block_size;
 
124
  LEX_STRING comment;
 
125
} KEY_CREATE_INFO;
 
126
 
 
127
 
 
128
typedef struct st_ha_check_opt
 
129
{
 
130
  st_ha_check_opt() {}                        /* Remove gcc warning */
 
131
} HA_CHECK_OPT;
 
132
 
 
133
 
 
134
typedef struct st_range_seq_if
 
135
{
 
136
  /*
 
137
    Initialize the traversal of range sequence
 
138
 
 
139
    SYNOPSIS
 
140
    init()
 
141
    init_params  The seq_init_param parameter
 
142
    n_ranges     The number of ranges obtained
 
143
    flags        A combination of HA_MRR_SINGLE_POINT, HA_MRR_FIXED_KEY
 
144
 
 
145
    RETURN
 
146
    An opaque value to be used as RANGE_SEQ_IF::next() parameter
 
147
  */
 
148
  range_seq_t (*init)(void *init_params, uint32_t n_ranges, uint32_t flags);
 
149
 
 
150
 
 
151
  /*
 
152
    Get the next range in the range sequence
 
153
 
 
154
    SYNOPSIS
 
155
    next()
 
156
    seq    The value returned by RANGE_SEQ_IF::init()
 
157
    range  OUT Information about the next range
 
158
 
 
159
    RETURN
 
160
    0 - Ok, the range structure filled with info about the next range
 
161
    1 - No more ranges
 
162
  */
 
163
  uint32_t (*next) (range_seq_t seq, KEY_MULTI_RANGE *range);
 
164
} RANGE_SEQ_IF;
 
165
 
 
166
/*
 
167
  This is a buffer area that the handler can use to store rows.
 
168
  'end_of_used_area' should be kept updated after calls to
 
169
  read-functions so that other parts of the code can use the
 
170
  remaining area (until next read calls is issued).
 
171
*/
 
172
 
 
173
typedef struct st_handler_buffer
 
174
{
 
175
  unsigned char *buffer;         /* Buffer one can start using */
 
176
  unsigned char *buffer_end;     /* End of buffer */
 
177
  unsigned char *end_of_used_area;     /* End of area that was used by handler */
 
178
} HANDLER_BUFFER;
 
179
 
 
180
#endif /* DRIZZLED_HANDLER_STRUCTS_H */