390.1.2
by Monty Taylor
Fixed copyright headers in drizzled/ |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
1999.6.1
by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file |
4 |
* Copyright (C) 2008 Sun Microsystems, Inc.
|
390.1.2
by Monty Taylor
Fixed copyright headers in drizzled/ |
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 |
*/
|
|
1
by brian
clean slate |
20 |
|
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
21 |
/* Structs that defines the Table */
|
1
by brian
clean slate |
22 |
|
2119.4.1
by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by |
23 |
|
24 |
||
327.1.2
by Brian Aker
Commiting next pass of Table class cleanup. |
25 |
#ifndef DRIZZLED_TABLE_H
|
26 |
#define DRIZZLED_TABLE_H
|
|
27 |
||
1122.2.13
by Monty Taylor
Header cleanup. |
28 |
#include <string> |
1802.16.1
by Padraig O'Sullivan
Replaced one instance of MyBitmap with dynamic_bitset from boost. Added some utility functions to MyBitmap temporarily in order to accomplish this. |
29 |
#include <boost/dynamic_bitset.hpp> |
1122.2.13
by Monty Taylor
Header cleanup. |
30 |
|
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
31 |
#include "drizzled/order.h" |
32 |
#include "drizzled/filesort_info.h" |
|
33 |
#include "drizzled/natural_join_column.h" |
|
34 |
#include "drizzled/field_iterator.h" |
|
1183.1.2
by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted |
35 |
#include "drizzled/cursor.h" |
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
36 |
#include "drizzled/lex_string.h" |
37 |
#include "drizzled/table_list.h" |
|
2069.4.3
by Brian Aker
Merge in move for share to be instance. |
38 |
#include "drizzled/table/instance.h" |
1130.3.4
by Monty Taylor
Merged in tree-wide include guard fixes and some header cleanup. |
39 |
#include "drizzled/atomics.h" |
1241.9.12
by Monty Taylor
Trims more out of server_includes.h. |
40 |
#include "drizzled/query_id.h" |
1100
by Brian Aker
Merge |
41 |
|
2119.4.1
by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by |
42 |
#include "drizzled/visibility.h" |
43 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
44 |
namespace drizzled |
45 |
{
|
|
46 |
||
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
47 |
class Item; |
1
by brian
clean slate |
48 |
class Item_subselect; |
848
by Brian Aker
typdef class removal (just... use the name of the class). |
49 |
class Select_Lex_Unit; |
846
by Brian Aker
Removing on typedeffed class. |
50 |
class Select_Lex; |
1
by brian
clean slate |
51 |
class COND_EQUAL; |
1273.11.1
by Dennis Schoen
rename class |
52 |
class SecurityContext; |
327.2.4
by Brian Aker
Refactoring table.h |
53 |
class TableList; |
1999.4.9
by Brian Aker
Created EPOCH |
54 |
namespace field { |
55 |
class Epoch; |
|
56 |
}
|
|
1
by brian
clean slate |
57 |
class Field_blob; |
58 |
||
1220.1.3
by Brian Aker
Remove atomic on refresh (go back to do it via lazy method). |
59 |
extern uint64_t refresh_version; |
1122.2.13
by Monty Taylor
Header cleanup. |
60 |
|
1
by brian
clean slate |
61 |
typedef enum enum_table_category TABLE_CATEGORY; |
1241.9.1
by Monty Taylor
Removed global.h. Fixed all the headers. |
62 |
typedef struct st_columndef MI_COLUMNDEF; |
1
by brian
clean slate |
63 |
|
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
64 |
/**
|
65 |
* Class representing a set of records, either in a temporary,
|
|
66 |
* normal, or derived table.
|
|
67 |
*/
|
|
2119.4.1
by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by |
68 |
class DRIZZLED_API Table |
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
69 |
{
|
70 |
Field **field; /**< Pointer to fields collection */ |
|
1578.2.16
by Brian Aker
Merge in change to getTable() to private the field objects. |
71 |
public: |
72 |
||
73 |
Field **getFields() const |
|
74 |
{
|
|
75 |
return field; |
|
76 |
}
|
|
77 |
||
78 |
Field *getField(uint32_t arg) const |
|
79 |
{
|
|
80 |
return field[arg]; |
|
81 |
}
|
|
82 |
||
83 |
void setFields(Field **arg) |
|
84 |
{
|
|
85 |
field= arg; |
|
86 |
}
|
|
87 |
||
88 |
void setFieldAt(Field *arg, uint32_t arg_pos) |
|
89 |
{
|
|
90 |
field[arg_pos]= arg; |
|
91 |
}
|
|
1030.1.1
by Brian Aker
Straighten out structures (remove some some dead bits). |
92 |
|
1208.3.2
by brian
Update for Cursor renaming. |
93 |
Cursor *cursor; /**< Pointer to the storage engine's Cursor managing this table */ |
1608
by Brian Aker
This encapsulates prev/next. |
94 |
private: |
1030.1.1
by Brian Aker
Straighten out structures (remove some some dead bits). |
95 |
Table *next; |
1608
by Brian Aker
This encapsulates prev/next. |
96 |
public: |
97 |
Table *getNext() const |
|
98 |
{
|
|
99 |
return next; |
|
100 |
}
|
|
101 |
||
102 |
Table **getNextPtr() |
|
103 |
{
|
|
104 |
return &next; |
|
105 |
}
|
|
106 |
||
107 |
void setNext(Table *arg) |
|
108 |
{
|
|
109 |
next= arg; |
|
110 |
}
|
|
111 |
||
1637.4.1
by Brian Aker
Wrap unused access with a class. |
112 |
void unlink() |
113 |
{
|
|
114 |
getNext()->setPrev(getPrev()); /* remove from used chain */ |
|
115 |
getPrev()->setNext(getNext()); |
|
116 |
}
|
|
117 |
||
1608
by Brian Aker
This encapsulates prev/next. |
118 |
private: |
1030.1.1
by Brian Aker
Straighten out structures (remove some some dead bits). |
119 |
Table *prev; |
1608
by Brian Aker
This encapsulates prev/next. |
120 |
public: |
121 |
Table *getPrev() const |
|
122 |
{
|
|
123 |
return prev; |
|
124 |
}
|
|
125 |
||
126 |
Table **getPrevPtr() |
|
127 |
{
|
|
128 |
return &prev; |
|
129 |
}
|
|
130 |
||
131 |
void setPrev(Table *arg) |
|
132 |
{
|
|
133 |
prev= arg; |
|
134 |
}
|
|
1030.1.1
by Brian Aker
Straighten out structures (remove some some dead bits). |
135 |
|
1802.16.8
by Padraig O'Sullivan
Removal of all MyBitmap from the code base. Compiles but test failures exist now. |
136 |
boost::dynamic_bitset<> *read_set; /* Active column sets */ |
137 |
boost::dynamic_bitset<> *write_set; /* Active column sets */ |
|
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
138 |
|
139 |
uint32_t tablenr; |
|
1208.3.2
by brian
Update for Cursor renaming. |
140 |
uint32_t db_stat; /**< information about the cursor as in Cursor.h */ |
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
141 |
|
1802.16.8
by Padraig O'Sullivan
Removal of all MyBitmap from the code base. Compiles but test failures exist now. |
142 |
boost::dynamic_bitset<> def_read_set; /**< Default read set of columns */ |
143 |
boost::dynamic_bitset<> def_write_set; /**< Default write set of columns */ |
|
144 |
boost::dynamic_bitset<> tmp_set; /* Not sure about this... */ |
|
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
145 |
|
1188.1.2
by Jay Pipes
Style and doxygen cleanup ONLY. Moves method documentation from source into header files. Removes TAB characters and cleans up indentation. |
146 |
Session *in_use; /**< Pointer to the current session using this object */ |
1320.1.18
by Brian Aker
Overhaul of SHOW TABLE STATUS. |
147 |
Session *getSession() |
148 |
{
|
|
149 |
return in_use; |
|
150 |
}
|
|
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
151 |
|
1672.3.6
by Brian Aker
First pass in encapsulating row |
152 |
unsigned char *getInsertRecord() |
153 |
{
|
|
154 |
return record[0]; |
|
155 |
}
|
|
156 |
||
157 |
unsigned char *getUpdateRecord() |
|
158 |
{
|
|
159 |
return record[1]; |
|
160 |
}
|
|
161 |
||
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
162 |
unsigned char *record[2]; /**< Pointer to "records" */ |
1672.3.5
by Brian Aker
This replaces the allocation we do for insert/update. |
163 |
std::vector<unsigned char> insert_values; /* used by INSERT ... UPDATE */ |
1535
by Brian Aker
Rename of KEY to KeyInfo |
164 |
KeyInfo *key_info; /**< data of keys in database */ |
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
165 |
Field *next_number_field; /**< Set if next_number is activated. @TODO What the heck is the difference between this and the next member? */ |
166 |
Field *found_next_number_field; /**< Points to the "next-number" field (autoincrement field) */ |
|
1999.4.9
by Brian Aker
Created EPOCH |
167 |
field::Epoch *timestamp_field; /**< Points to the auto-setting timestamp field, if any */ |
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
168 |
|
169 |
TableList *pos_in_table_list; /* Element referring to this table */ |
|
1892.3.3
by tdavies
struct order_st changed and renamed to c++ class named:Order |
170 |
Order *group; |
1669.2.6
by Brian Aker
First pass through encapsulating getAlias() from table. |
171 |
|
172 |
const char *getAlias() const |
|
173 |
{
|
|
1864.4.4
by Brian Aker
We now handle the free of the alias inside of table. |
174 |
return _alias.c_str(); |
175 |
}
|
|
176 |
||
177 |
void clearAlias() |
|
178 |
{
|
|
179 |
_alias.clear(); |
|
180 |
}
|
|
181 |
||
182 |
void setAlias(const char *arg) |
|
183 |
{
|
|
184 |
_alias= arg; |
|
185 |
}
|
|
186 |
||
187 |
private: |
|
188 |
std::string _alias; /**< alias or table name if no alias */ |
|
189 |
public: |
|
1669.2.6
by Brian Aker
First pass through encapsulating getAlias() from table. |
190 |
|
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
191 |
unsigned char *null_flags; |
1
by brian
clean slate |
192 |
|
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
193 |
uint32_t lock_position; /**< Position in DRIZZLE_LOCK.table */ |
194 |
uint32_t lock_data_start; /**< Start pos. in DRIZZLE_LOCK.locks */ |
|
195 |
uint32_t lock_count; /**< Number of locks */ |
|
1030.1.2
by Brian Aker
More alignment for structures |
196 |
uint32_t used_fields; |
1672.3.6
by Brian Aker
First pass in encapsulating row |
197 |
uint32_t status; /* What's in getInsertRecord() */ |
1
by brian
clean slate |
198 |
/* number of select if it is derived table */
|
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
199 |
uint32_t derived_select_number; |
1188.1.2
by Jay Pipes
Style and doxygen cleanup ONLY. Moves method documentation from source into header files. Removes TAB characters and cleans up indentation. |
200 |
int current_lock; /**< Type of lock on table */ |
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
201 |
bool copy_blobs; /**< Should blobs by copied when storing? */ |
1
by brian
clean slate |
202 |
|
203 |
/*
|
|
204 |
0 or JOIN_TYPE_{LEFT|RIGHT}. Currently this is only compared to 0.
|
|
205 |
If maybe_null !=0, this table is inner w.r.t. some outer join operation,
|
|
206 |
and null_row may be true.
|
|
207 |
*/
|
|
327.1.3
by Brian Aker
Cleaned up depend in Proto utils. Modified int to bool. Put TmpTable class |
208 |
bool maybe_null; |
209 |
||
1
by brian
clean slate |
210 |
/*
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
211 |
If true, the current table row is considered to have all columns set to
|
1
by brian
clean slate |
212 |
NULL, including columns declared as "not null" (see maybe_null).
|
213 |
*/
|
|
274
by Brian Aker
my_bool conversion in Table |
214 |
bool null_row; |
1
by brian
clean slate |
215 |
|
274
by Brian Aker
my_bool conversion in Table |
216 |
bool force_index; |
1672.3.2
by Brian Aker
Tiny little cleanup around Table. |
217 |
bool distinct; |
218 |
bool const_table; |
|
219 |
bool no_rows; |
|
1030.1.2
by Brian Aker
More alignment for structures |
220 |
bool key_read; |
221 |
bool no_keyread; |
|
1
by brian
clean slate |
222 |
/*
|
223 |
Placeholder for an open table which prevents other connections
|
|
224 |
from taking name-locks on this table. Typically used with
|
|
1000.1.3
by Brian Aker
Renamed TABLE_SHARE to TableShare |
225 |
TableShare::version member to take an exclusive name-lock on
|
1
by brian
clean slate |
226 |
this table name -- a name lock that not only prevents other
|
227 |
threads from opening the table, but also blocks other name
|
|
228 |
locks. This is achieved by:
|
|
229 |
- setting open_placeholder to 1 - this will block other name
|
|
230 |
locks, as wait_for_locked_table_name will be forced to wait,
|
|
231 |
see table_is_used for details.
|
|
232 |
- setting version to 0 - this will force other threads to close
|
|
233 |
the instance of this table and wait (this is the same approach
|
|
234 |
as used for usual name locks).
|
|
1183.1.2
by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted |
235 |
An exclusively name-locked table currently can have no Cursor
|
1
by brian
clean slate |
236 |
object associated with it (db_stat is always 0), but please do
|
237 |
not rely on that.
|
|
238 |
*/
|
|
274
by Brian Aker
my_bool conversion in Table |
239 |
bool open_placeholder; |
240 |
bool locked_by_name; |
|
241 |
bool no_cache; |
|
1
by brian
clean slate |
242 |
/*
|
243 |
To indicate that a non-null value of the auto_increment field
|
|
244 |
was provided by the user or retrieved from the current record.
|
|
245 |
Used only in the MODE_NO_AUTO_VALUE_ON_ZERO mode.
|
|
246 |
*/
|
|
274
by Brian Aker
my_bool conversion in Table |
247 |
bool auto_increment_field_not_null; |
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
248 |
bool alias_name_used; /* true if table_name is alias */ |
1030.1.2
by Brian Aker
More alignment for structures |
249 |
|
250 |
/*
|
|
251 |
The ID of the query that opened and is using this table. Has different
|
|
252 |
meanings depending on the table type.
|
|
253 |
||
254 |
Temporary tables:
|
|
255 |
||
256 |
table->query_id is set to session->query_id for the duration of a statement
|
|
257 |
and is reset to 0 once it is closed by the same statement. A non-zero
|
|
258 |
table->query_id means that a statement is using the table even if it's
|
|
259 |
not the current statement (table is in use by some outer statement).
|
|
260 |
||
261 |
Non-temporary tables:
|
|
262 |
||
263 |
Under pre-locked or LOCK TABLES mode: query_id is set to session->query_id
|
|
264 |
for the duration of a statement and is reset to 0 once it is closed by
|
|
265 |
the same statement. A non-zero query_id is used to control which tables
|
|
266 |
in the list of pre-opened and locked tables are actually being used.
|
|
267 |
*/
|
|
1188.1.2
by Jay Pipes
Style and doxygen cleanup ONLY. Moves method documentation from source into header files. Removes TAB characters and cleans up indentation. |
268 |
query_id_t query_id; |
1030.1.2
by Brian Aker
More alignment for structures |
269 |
|
1188.1.2
by Jay Pipes
Style and doxygen cleanup ONLY. Moves method documentation from source into header files. Removes TAB characters and cleans up indentation. |
270 |
/**
|
271 |
* Estimate of number of records that satisfy SARGable part of the table
|
|
1208.3.2
by brian
Update for Cursor renaming. |
272 |
* condition, or table->cursor->records if no SARGable condition could be
|
1188.1.2
by Jay Pipes
Style and doxygen cleanup ONLY. Moves method documentation from source into header files. Removes TAB characters and cleans up indentation. |
273 |
* constructed.
|
274 |
* This value is used by join optimizer as an estimate of number of records
|
|
275 |
* that will pass the table condition (condition that depends on fields of
|
|
276 |
* this table and constants)
|
|
277 |
*/
|
|
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
278 |
ha_rows quick_condition_rows; |
1030.1.2
by Brian Aker
More alignment for structures |
279 |
|
280 |
/*
|
|
281 |
If this table has TIMESTAMP field with auto-set property (pointed by
|
|
282 |
timestamp_field member) then this variable indicates during which
|
|
283 |
operations (insert only/on update/in both cases) we should set this
|
|
284 |
field to current timestamp. If there are no such field in this table
|
|
285 |
or we should not automatically set its value during execution of current
|
|
286 |
statement then the variable contains TIMESTAMP_NO_AUTO_SET (i.e. 0).
|
|
287 |
||
288 |
Value of this variable is set for each statement in open_table() and
|
|
2026.2.1
by Monty Taylor
Renamed things prefixed mysql_ or mysqld_ |
289 |
if needed cleared later in statement processing code (see update_query()
|
1030.1.2
by Brian Aker
More alignment for structures |
290 |
as example).
|
291 |
*/
|
|
292 |
timestamp_auto_set_type timestamp_field_type; |
|
1188.1.2
by Jay Pipes
Style and doxygen cleanup ONLY. Moves method documentation from source into header files. Removes TAB characters and cleans up indentation. |
293 |
table_map map; ///< ID bit of table (1,2,4,8,16...) |
1
by brian
clean slate |
294 |
|
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
295 |
RegInfo reginfo; /* field connections */ |
1030.1.2
by Brian Aker
More alignment for structures |
296 |
|
297 |
/*
|
|
298 |
Map of keys that can be used to retrieve all data from this table
|
|
299 |
needed by the query without reading the row.
|
|
300 |
*/
|
|
301 |
key_map covering_keys; |
|
302 |
key_map quick_keys; |
|
303 |
key_map merge_keys; |
|
304 |
||
305 |
/*
|
|
306 |
A set of keys that can be used in the query that references this
|
|
307 |
table.
|
|
308 |
||
309 |
All indexes disabled on the table's TableShare (see Table::s) will be
|
|
310 |
subtracted from this set upon instantiation. Thus for any Table t it holds
|
|
311 |
that t.keys_in_use_for_query is a subset of t.s.keys_in_use. Generally we
|
|
312 |
must not introduce any new keys here (see setup_tables).
|
|
313 |
||
314 |
The set is implemented as a bitmap.
|
|
315 |
*/
|
|
316 |
key_map keys_in_use_for_query; |
|
317 |
/* Map of keys that can be used to calculate GROUP BY without sorting */
|
|
318 |
key_map keys_in_use_for_group_by; |
|
319 |
/* Map of keys that can be used to calculate ORDER BY without sorting */
|
|
320 |
key_map keys_in_use_for_order_by; |
|
321 |
||
322 |
/*
|
|
323 |
For each key that has quick_keys.test(key) == true: estimate of #records
|
|
324 |
and max #key parts that range access would use.
|
|
325 |
*/
|
|
1188.1.2
by Jay Pipes
Style and doxygen cleanup ONLY. Moves method documentation from source into header files. Removes TAB characters and cleans up indentation. |
326 |
ha_rows quick_rows[MAX_KEY]; |
1030.1.2
by Brian Aker
More alignment for structures |
327 |
|
328 |
/* Bitmaps of key parts that =const for the entire join. */
|
|
329 |
key_part_map const_key_parts[MAX_KEY]; |
|
330 |
||
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
331 |
uint32_t quick_key_parts[MAX_KEY]; |
332 |
uint32_t quick_n_ranges[MAX_KEY]; |
|
1030.1.2
by Brian Aker
More alignment for structures |
333 |
|
1532.1.15
by Brian Aker
Partial encapsulation of TableShare from Table. |
334 |
private: |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
335 |
memory::Root mem_root; |
1532.1.4
by Brian Aker
Remove memset() on table, also add methods to table for allocation |
336 |
|
337 |
void init_mem_root() |
|
338 |
{
|
|
339 |
init_sql_alloc(&mem_root, TABLE_ALLOC_BLOCK_SIZE, 0); |
|
340 |
}
|
|
341 |
public: |
|
342 |
memory::Root *getMemRoot() |
|
343 |
{
|
|
344 |
if (not mem_root.alloc_root_inited()) |
|
345 |
{
|
|
346 |
init_mem_root(); |
|
347 |
}
|
|
348 |
||
349 |
return &mem_root; |
|
350 |
}
|
|
351 |
||
352 |
void *alloc_root(size_t arg) |
|
353 |
{
|
|
354 |
if (not mem_root.alloc_root_inited()) |
|
355 |
{
|
|
356 |
init_mem_root(); |
|
357 |
}
|
|
358 |
||
359 |
return mem_root.alloc_root(arg); |
|
360 |
}
|
|
361 |
||
362 |
char *strmake_root(const char *str_arg, size_t len_arg) |
|
363 |
{
|
|
364 |
if (not mem_root.alloc_root_inited()) |
|
365 |
{
|
|
366 |
init_mem_root(); |
|
367 |
}
|
|
368 |
||
369 |
return mem_root.strmake_root(str_arg, len_arg); |
|
370 |
}
|
|
371 |
||
1826.1.1
by tdavies
Bug:621861 Changed C structs to C++ class in the following files: filesort.cc, filesort_info.h, sql_sort.h, table.h. removed the '_st' from the name of some of the classes. For more detail of changes made read the merge proposal notes. |
372 |
filesort_info sort; |
1
by brian
clean slate |
373 |
|
1241.9.1
by Monty Taylor
Removed global.h. Fixed all the headers. |
374 |
Table(); |
1864.4.3
by Brian Aker
Move mem_root to the destructor. |
375 |
virtual ~Table(); |
327.1.1
by Brian Aker
First pass in encapsulating table (it is now an object, no longer a structure). |
376 |
|
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
377 |
int report_error(int error); |
1188.1.2
by Jay Pipes
Style and doxygen cleanup ONLY. Moves method documentation from source into header files. Removes TAB characters and cleans up indentation. |
378 |
/**
|
379 |
* Free information allocated by openfrm
|
|
380 |
*
|
|
381 |
* @param If true if we also want to free table_share
|
|
1502.1.3
by Brian Aker
Cleanup to use references. |
382 |
* @note this should all be the destructor
|
1188.1.2
by Jay Pipes
Style and doxygen cleanup ONLY. Moves method documentation from source into header files. Removes TAB characters and cleans up indentation. |
383 |
*/
|
1672.3.2
by Brian Aker
Tiny little cleanup around Table. |
384 |
int delete_table(bool free_share= false); |
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
385 |
|
1241.9.1
by Monty Taylor
Removed global.h. Fixed all the headers. |
386 |
void resetTable(Session *session, TableShare *share, uint32_t db_stat_arg); |
1030.1.2
by Brian Aker
More alignment for structures |
387 |
|
1030.1.1
by Brian Aker
Straighten out structures (remove some some dead bits). |
388 |
/* SHARE methods */
|
1859.2.10
by Brian Aker
Move all of the table bits out so that Table is an abstract class. |
389 |
virtual const TableShare *getShare() const= 0; /* Get rid of this long term */ |
390 |
virtual TableShare *getMutableShare()= 0; /* Get rid of this long term */ |
|
391 |
virtual bool hasShare() const= 0; /* Get rid of this long term */ |
|
392 |
virtual void setShare(TableShare *new_share)= 0; /* Get rid of this long term */ |
|
393 |
||
1903.1.1
by Brian Aker
Merge of partial set of patches for locks. |
394 |
virtual void release(void)= 0; |
395 |
||
1859.2.10
by Brian Aker
Move all of the table bits out so that Table is an abstract class. |
396 |
uint32_t sizeKeys() { return getMutableShare()->sizeKeys(); } |
397 |
uint32_t sizeFields() { return getMutableShare()->sizeFields(); } |
|
398 |
uint32_t getRecordLength() const { return getShare()->getRecordLength(); } |
|
399 |
uint32_t sizeBlobFields() { return getMutableShare()->blob_fields; } |
|
400 |
uint32_t *getBlobField() { return &getMutableShare()->blob_field[0]; } |
|
1593
by Brian Aker
Merge in Barry. |
401 |
|
1835.1.3
by Brian Aker
Fix variable such that we no longer pass share to varstring on creation. |
402 |
public: |
403 |
virtual bool hasVariableWidth() const |
|
404 |
{
|
|
405 |
return getShare()->hasVariableWidth(); // We should calculate this. |
|
406 |
}
|
|
407 |
||
408 |
virtual void setVariableWidth(void); |
|
409 |
||
1593
by Brian Aker
Merge in Barry. |
410 |
Field_blob *getBlobFieldAt(uint32_t arg) const |
1548.2.4
by Barry.Leslie at PrimeBase
Changed the table event observers to pass the 'Table' not the TableShare' to the observers. |
411 |
{
|
1827.2.2
by Brian Aker
Encapsulate the share in Table. |
412 |
if (arg < getShare()->blob_fields) |
413 |
return (Field_blob*) field[getShare()->blob_field[arg]]; /*NOTE: Using 'Table.field' NOT SharedTable.field. */ |
|
1593
by Brian Aker
Merge in Barry. |
414 |
|
415 |
return NULL; |
|
1548.2.4
by Barry.Leslie at PrimeBase
Changed the table event observers to pass the 'Table' not the TableShare' to the observers. |
416 |
}
|
1827.2.2
by Brian Aker
Encapsulate the share in Table. |
417 |
inline uint8_t getBlobPtrSize() { return getShare()->blob_ptr_size; } |
418 |
inline uint32_t getNullBytes() { return getShare()->null_bytes; } |
|
419 |
inline uint32_t getNullFields() { return getShare()->null_fields; } |
|
420 |
inline unsigned char *getDefaultValues() { return getMutableShare()->getDefaultValues(); } |
|
421 |
inline const char *getSchemaName() const { return getShare()->getSchemaName(); } |
|
422 |
inline const char *getTableName() const { return getShare()->getTableName(); } |
|
1030.1.1
by Brian Aker
Straighten out structures (remove some some dead bits). |
423 |
|
1827.2.2
by Brian Aker
Encapsulate the share in Table. |
424 |
inline bool isDatabaseLowByteFirst() { return getShare()->db_low_byte_first; } /* Portable row format */ |
1910.2.9
by Brian Aker
Remove a bunch of dead code from within table share. |
425 |
inline bool isNameLock() const { return open_placeholder; } |
1030.1.1
by Brian Aker
Straighten out structures (remove some some dead bits). |
426 |
|
1235.1.14
by Brian Aker
Final move of index flags up to Engine (new interface still needed). |
427 |
uint32_t index_flags(uint32_t idx) const |
428 |
{
|
|
1827.2.2
by Brian Aker
Encapsulate the share in Table. |
429 |
return getShare()->storage_engine->index_flags(getShare()->getKeyInfo(idx).algorithm); |
1235.1.14
by Brian Aker
Final move of index flags up to Engine (new interface still needed). |
430 |
}
|
431 |
||
1455.6.1
by Yanbo Wu
convert st_foreign_key_info to class ForeignKeyInfo |
432 |
inline plugin::StorageEngine *getEngine() const /* table_type for handler */ |
1235.1.2
by Brian Aker
Added engine flag so that an engine can skip store_lock. |
433 |
{
|
1827.2.2
by Brian Aker
Encapsulate the share in Table. |
434 |
return getShare()->storage_engine; |
1235.1.2
by Brian Aker
Added engine flag so that an engine can skip store_lock. |
435 |
}
|
436 |
||
1455.6.1
by Yanbo Wu
convert st_foreign_key_info to class ForeignKeyInfo |
437 |
Cursor &getCursor() const /* table_type for handler */ |
1320.1.18
by Brian Aker
Overhaul of SHOW TABLE STATUS. |
438 |
{
|
439 |
assert(cursor); |
|
440 |
return *cursor; |
|
441 |
}
|
|
442 |
||
1030.1.1
by Brian Aker
Straighten out structures (remove some some dead bits). |
443 |
size_t max_row_length(const unsigned char *data); |
444 |
uint32_t find_shortest_key(const key_map *usable_keys); |
|
445 |
bool compare_record(Field **ptr); |
|
1819.9.151
by Martin Hansson, Stewart Smith
Merge Revision revid:martin.hansson@oracle.com-20101007081311-zb72jgqjx2rs831z from MySQL InnoDB |
446 |
bool records_are_comparable(); |
447 |
bool compare_records(); |
|
1030.1.1
by Brian Aker
Straighten out structures (remove some some dead bits). |
448 |
/* TODO: the (re)storeRecord's may be able to be further condensed */
|
449 |
void storeRecord(); |
|
450 |
void storeRecordAsInsert(); |
|
451 |
void storeRecordAsDefault(); |
|
452 |
void restoreRecord(); |
|
453 |
void restoreRecordAsDefault(); |
|
454 |
void emptyRecord(); |
|
455 |
||
1908.1.1
by Brian Aker
Merge in encapsulations in filesort. |
456 |
|
1030.1.1
by Brian Aker
Straighten out structures (remove some some dead bits). |
457 |
/* See if this can be blown away */
|
458 |
inline uint32_t getDBStat () { return db_stat; } |
|
459 |
inline uint32_t setDBStat () { return db_stat; } |
|
1188.1.2
by Jay Pipes
Style and doxygen cleanup ONLY. Moves method documentation from source into header files. Removes TAB characters and cleans up indentation. |
460 |
/**
|
461 |
* Create Item_field for each column in the table.
|
|
462 |
*
|
|
463 |
* @param[out] a pointer to an empty list used to store items
|
|
464 |
*
|
|
465 |
* @details
|
|
466 |
*
|
|
467 |
* Create Item_field object for each column in the table and
|
|
468 |
* initialize it with the corresponding Field. New items are
|
|
469 |
* created in the current Session memory root.
|
|
470 |
*
|
|
471 |
* @retval
|
|
472 |
* false on success
|
|
473 |
* @retval
|
|
474 |
* true when out of memory
|
|
475 |
*/
|
|
1
by brian
clean slate |
476 |
bool fill_item_list(List<Item> *item_list) const; |
477 |
void clear_column_bitmaps(void); |
|
478 |
void prepare_for_position(void); |
|
1802.16.1
by Padraig O'Sullivan
Replaced one instance of MyBitmap with dynamic_bitset from boost. Added some utility functions to MyBitmap temporarily in order to accomplish this. |
479 |
void mark_columns_used_by_index_no_reset(uint32_t index, boost::dynamic_bitset<>& bitmap); |
1003.1.7
by Brian Aker
Add mark_columns_used_by_index_no_reset() with just index (assumes read_set |
480 |
void mark_columns_used_by_index_no_reset(uint32_t index); |
482
by Brian Aker
Remove uint. |
481 |
void mark_columns_used_by_index(uint32_t index); |
1
by brian
clean slate |
482 |
void restore_column_maps_after_mark_index(); |
483 |
void mark_auto_increment_column(void); |
|
484 |
void mark_columns_needed_for_update(void); |
|
485 |
void mark_columns_needed_for_delete(void); |
|
486 |
void mark_columns_needed_for_insert(void); |
|
1802.16.9
by Padraig O'Sullivan
Resolved bitset handling during temporary table creation. All tests pass again. |
487 |
void column_bitmaps_set(boost::dynamic_bitset<>& read_set_arg, |
488 |
boost::dynamic_bitset<>& write_set_arg); |
|
354
by Brian Aker
Refactor of Table methods. |
489 |
|
1802.16.8
by Padraig O'Sullivan
Removal of all MyBitmap from the code base. Compiles but test failures exist now. |
490 |
void restore_column_map(const boost::dynamic_bitset<>& old); |
354
by Brian Aker
Refactor of Table methods. |
491 |
|
1802.16.8
by Padraig O'Sullivan
Removal of all MyBitmap from the code base. Compiles but test failures exist now. |
492 |
const boost::dynamic_bitset<> use_all_columns(boost::dynamic_bitset<>& map); |
1
by brian
clean slate |
493 |
inline void use_all_columns() |
494 |
{
|
|
1827.2.2
by Brian Aker
Encapsulate the share in Table. |
495 |
column_bitmaps_set(getMutableShare()->all_set, getMutableShare()->all_set); |
1
by brian
clean slate |
496 |
}
|
354
by Brian Aker
Refactor of Table methods. |
497 |
|
1
by brian
clean slate |
498 |
inline void default_column_bitmaps() |
499 |
{
|
|
500 |
read_set= &def_read_set; |
|
501 |
write_set= &def_write_set; |
|
502 |
}
|
|
354
by Brian Aker
Refactor of Table methods. |
503 |
|
1003.1.12
by Brian Aker
Begin of abstract out the bitmap from direct reference. |
504 |
/* Both of the below should go away once we can move this bit to the field objects */
|
505 |
inline bool isReadSet(uint32_t index) |
|
506 |
{
|
|
1802.16.8
by Padraig O'Sullivan
Removal of all MyBitmap from the code base. Compiles but test failures exist now. |
507 |
return read_set->test(index); |
1003.1.12
by Brian Aker
Begin of abstract out the bitmap from direct reference. |
508 |
}
|
509 |
||
510 |
inline void setReadSet(uint32_t index) |
|
511 |
{
|
|
1802.16.8
by Padraig O'Sullivan
Removal of all MyBitmap from the code base. Compiles but test failures exist now. |
512 |
read_set->set(index); |
1003.1.12
by Brian Aker
Begin of abstract out the bitmap from direct reference. |
513 |
}
|
514 |
||
1005.2.12
by Monty Taylor
Moved some things to the API. |
515 |
inline void setReadSet() |
516 |
{
|
|
1802.16.8
by Padraig O'Sullivan
Removal of all MyBitmap from the code base. Compiles but test failures exist now. |
517 |
read_set->set(); |
1005.2.12
by Monty Taylor
Moved some things to the API. |
518 |
}
|
519 |
||
1039.5.42
by Jay Pipes
Splits out the previously aggregated all.test case into separate test |
520 |
inline void clearReadSet(uint32_t index) |
521 |
{
|
|
1802.16.8
by Padraig O'Sullivan
Removal of all MyBitmap from the code base. Compiles but test failures exist now. |
522 |
read_set->reset(index); |
1039.5.42
by Jay Pipes
Splits out the previously aggregated all.test case into separate test |
523 |
}
|
524 |
||
525 |
inline void clearReadSet() |
|
526 |
{
|
|
1802.16.8
by Padraig O'Sullivan
Removal of all MyBitmap from the code base. Compiles but test failures exist now. |
527 |
read_set->reset(); |
1039.5.42
by Jay Pipes
Splits out the previously aggregated all.test case into separate test |
528 |
}
|
529 |
||
1003.1.12
by Brian Aker
Begin of abstract out the bitmap from direct reference. |
530 |
inline bool isWriteSet(uint32_t index) |
531 |
{
|
|
1802.16.8
by Padraig O'Sullivan
Removal of all MyBitmap from the code base. Compiles but test failures exist now. |
532 |
return write_set->test(index); |
1003.1.12
by Brian Aker
Begin of abstract out the bitmap from direct reference. |
533 |
}
|
534 |
||
535 |
inline void setWriteSet(uint32_t index) |
|
536 |
{
|
|
1802.16.8
by Padraig O'Sullivan
Removal of all MyBitmap from the code base. Compiles but test failures exist now. |
537 |
write_set->set(index); |
1003.1.12
by Brian Aker
Begin of abstract out the bitmap from direct reference. |
538 |
}
|
539 |
||
1005.2.12
by Monty Taylor
Moved some things to the API. |
540 |
inline void setWriteSet() |
541 |
{
|
|
1802.16.8
by Padraig O'Sullivan
Removal of all MyBitmap from the code base. Compiles but test failures exist now. |
542 |
write_set->set(); |
1005.2.12
by Monty Taylor
Moved some things to the API. |
543 |
}
|
544 |
||
1039.5.42
by Jay Pipes
Splits out the previously aggregated all.test case into separate test |
545 |
inline void clearWriteSet(uint32_t index) |
546 |
{
|
|
1802.16.8
by Padraig O'Sullivan
Removal of all MyBitmap from the code base. Compiles but test failures exist now. |
547 |
write_set->reset(index); |
1039.5.42
by Jay Pipes
Splits out the previously aggregated all.test case into separate test |
548 |
}
|
549 |
||
550 |
inline void clearWriteSet() |
|
551 |
{
|
|
1802.16.8
by Padraig O'Sullivan
Removal of all MyBitmap from the code base. Compiles but test failures exist now. |
552 |
write_set->reset(); |
1039.5.42
by Jay Pipes
Splits out the previously aggregated all.test case into separate test |
553 |
}
|
554 |
||
1
by brian
clean slate |
555 |
/* Is table open or should be treated as such by name-locking? */
|
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
556 |
inline bool is_name_opened() |
557 |
{
|
|
558 |
return db_stat || open_placeholder; |
|
559 |
}
|
|
1
by brian
clean slate |
560 |
/*
|
561 |
Is this instance of the table should be reopen or represents a name-lock?
|
|
562 |
*/
|
|
563 |
inline bool needs_reopen_or_name_lock() |
|
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
564 |
{
|
1827.2.2
by Brian Aker
Encapsulate the share in Table. |
565 |
return getShare()->getVersion() != refresh_version; |
1055.2.2
by Jay Pipes
Cleanup of style, indentation, and documentation of Table class members. Removed 5 or 6 dead Table member variables. |
566 |
}
|
354
by Brian Aker
Refactor of Table methods. |
567 |
|
934.1.1
by Brian Aker
Moved two functions in classes. |
568 |
/**
|
569 |
clean/setup table fields and map.
|
|
570 |
||
571 |
@param table Table structure pointer (which should be setup)
|
|
572 |
@param table_list TableList structure pointer (owner of Table)
|
|
573 |
@param tablenr table number
|
|
574 |
*/
|
|
575 |
void setup_table_map(TableList *table_list, uint32_t tablenr); |
|
576 |
inline void mark_as_null_row() |
|
577 |
{
|
|
1055.2.3
by Jay Pipes
Removed dead Table::table_check_intact() method. |
578 |
null_row= 1; |
579 |
status|= STATUS_NULL_ROW; |
|
1827.2.2
by Brian Aker
Encapsulate the share in Table. |
580 |
memset(null_flags, 255, getShare()->null_bytes); |
934.1.1
by Brian Aker
Moved two functions in classes. |
581 |
}
|
1109.1.1
by Brian Aker
Applying refactor of tmp table bits back to session. (this all needs to be |
582 |
|
1109.1.4
by Brian Aker
More Table refactor |
583 |
void free_io_cache(); |
584 |
void filesort_free_buffers(bool full= false); |
|
585 |
void intern_close_table(); |
|
1216.1.1
by Brian Aker
Move print_error up to Engine. |
586 |
|
587 |
void print_error(int error, myf errflag) |
|
588 |
{
|
|
1827.2.2
by Brian Aker
Encapsulate the share in Table. |
589 |
getShare()->storage_engine->print_error(error, errflag, *this); |
1216.1.1
by Brian Aker
Move print_error up to Engine. |
590 |
}
|
591 |
||
592 |
/**
|
|
593 |
@return
|
|
594 |
key if error because of duplicated keys
|
|
595 |
*/
|
|
596 |
uint32_t get_dup_key(int error) |
|
597 |
{
|
|
598 |
cursor->errkey = (uint32_t) -1; |
|
599 |
if (error == HA_ERR_FOUND_DUPP_KEY || error == HA_ERR_FOREIGN_DUPLICATE_KEY || |
|
600 |
error == HA_ERR_FOUND_DUPP_UNIQUE || |
|
601 |
error == HA_ERR_DROP_INDEX_FK) |
|
602 |
cursor->info(HA_STATUS_ERRKEY | HA_STATUS_NO_LOCK); |
|
603 |
||
604 |
return(cursor->errkey); |
|
605 |
}
|
|
1320.1.18
by Brian Aker
Overhaul of SHOW TABLE STATUS. |
606 |
|
607 |
/*
|
|
608 |
This is a short term fix. Long term we will used the TableIdentifier to do the actual comparison.
|
|
609 |
*/
|
|
610 |
bool operator<(const Table &right) const |
|
611 |
{
|
|
1999.4.3
by Brian Aker
Minor optimization for sorting tables. |
612 |
return getShare()->getCacheKey() < right.getShare()->getCacheKey(); |
1320.1.18
by Brian Aker
Overhaul of SHOW TABLE STATUS. |
613 |
}
|
614 |
||
615 |
static bool compare(const Table *a, const Table *b) |
|
616 |
{
|
|
617 |
return *a < *b; |
|
618 |
}
|
|
619 |
||
620 |
friend std::ostream& operator<<(std::ostream& output, const Table &table) |
|
621 |
{
|
|
1903.1.1
by Brian Aker
Merge of partial set of patches for locks. |
622 |
if (table.getShare()) |
623 |
{
|
|
624 |
output << "Table:("; |
|
625 |
output << table.getShare()->getSchemaName(); |
|
626 |
output << ", "; |
|
627 |
output << table.getShare()->getTableName(); |
|
628 |
output << ", "; |
|
629 |
output << table.getShare()->getTableTypeAsString(); |
|
630 |
output << ")"; |
|
631 |
}
|
|
632 |
else
|
|
633 |
{
|
|
634 |
output << "Table:(has no share)"; |
|
635 |
}
|
|
1320.1.18
by Brian Aker
Overhaul of SHOW TABLE STATUS. |
636 |
|
637 |
return output; // for multiple << operators. |
|
638 |
}
|
|
639 |
||
1532.1.14
by Brian Aker
We no longer use alloc for placeholders (due to HASH I didn't use a |
640 |
public: |
1843.7.2
by Brian Aker
Fix placeholder to actuall be a placeholder via methods. |
641 |
virtual bool isPlaceHolder(void) const |
1502.1.19
by Brian Aker
Adds concept of table owned TableShare. |
642 |
{
|
1843.7.2
by Brian Aker
Fix placeholder to actuall be a placeholder via methods. |
643 |
return false; |
1502.1.19
by Brian Aker
Adds concept of table owned TableShare. |
644 |
}
|
1
by brian
clean slate |
645 |
};
|
646 |
||
1455.6.1
by Yanbo Wu
convert st_foreign_key_info to class ForeignKeyInfo |
647 |
/**
|
648 |
* @class
|
|
649 |
* ForeignKeyInfo
|
|
650 |
*
|
|
651 |
* @brief
|
|
652 |
* This class defines the information for foreign keys.
|
|
653 |
*/
|
|
654 |
class ForeignKeyInfo |
|
1
by brian
clean slate |
655 |
{
|
1455.6.1
by Yanbo Wu
convert st_foreign_key_info to class ForeignKeyInfo |
656 |
public: |
657 |
/**
|
|
658 |
* @brief
|
|
659 |
* This is the constructor with all properties set.
|
|
660 |
*
|
|
661 |
* @param[in] in_foreign_id The id of the foreign key
|
|
662 |
* @param[in] in_referenced_db The referenced database name of the foreign key
|
|
663 |
* @param[in] in_referenced_table The referenced table name of the foreign key
|
|
664 |
* @param[in] in_update_method The update method of the foreign key.
|
|
665 |
* @param[in] in_delete_method The delete method of the foreign key.
|
|
666 |
* @param[in] in_referenced_key_name The name of referenced key
|
|
667 |
* @param[in] in_foreign_fields The foreign fields
|
|
668 |
* @param[in] in_referenced_fields The referenced fields
|
|
669 |
*/
|
|
670 |
ForeignKeyInfo(LEX_STRING *in_foreign_id, |
|
671 |
LEX_STRING *in_referenced_db, |
|
672 |
LEX_STRING *in_referenced_table, |
|
673 |
LEX_STRING *in_update_method, |
|
674 |
LEX_STRING *in_delete_method, |
|
675 |
LEX_STRING *in_referenced_key_name, |
|
676 |
List<LEX_STRING> in_foreign_fields, |
|
677 |
List<LEX_STRING> in_referenced_fields) |
|
678 |
:
|
|
679 |
foreign_id(in_foreign_id), |
|
680 |
referenced_db(in_referenced_db), |
|
681 |
referenced_table(in_referenced_table), |
|
682 |
update_method(in_update_method), |
|
683 |
delete_method(in_delete_method), |
|
684 |
referenced_key_name(in_referenced_key_name), |
|
685 |
foreign_fields(in_foreign_fields), |
|
686 |
referenced_fields(in_referenced_fields) |
|
687 |
{}
|
|
688 |
||
689 |
/**
|
|
690 |
* @brief
|
|
691 |
* This is the default constructor. All properties are set to default values for their types.
|
|
692 |
*/
|
|
693 |
ForeignKeyInfo() |
|
694 |
: foreign_id(NULL), referenced_db(NULL), referenced_table(NULL), |
|
695 |
update_method(NULL), delete_method(NULL), referenced_key_name(NULL) |
|
696 |
{}
|
|
697 |
||
698 |
/**
|
|
699 |
* @brief
|
|
700 |
* Gets the foreign id.
|
|
701 |
*
|
|
702 |
* @ retval the foreign id
|
|
703 |
*/
|
|
704 |
const LEX_STRING *getForeignId() const |
|
705 |
{
|
|
706 |
return foreign_id; |
|
707 |
}
|
|
708 |
||
709 |
/**
|
|
710 |
* @brief
|
|
711 |
* Gets the name of the referenced database.
|
|
712 |
*
|
|
713 |
* @ retval the name of the referenced database
|
|
714 |
*/
|
|
715 |
const LEX_STRING *getReferencedDb() const |
|
716 |
{
|
|
717 |
return referenced_db; |
|
718 |
}
|
|
719 |
||
720 |
/**
|
|
721 |
* @brief
|
|
722 |
* Gets the name of the referenced table.
|
|
723 |
*
|
|
724 |
* @ retval the name of the referenced table
|
|
725 |
*/
|
|
726 |
const LEX_STRING *getReferencedTable() const |
|
727 |
{
|
|
728 |
return referenced_table; |
|
729 |
}
|
|
730 |
||
731 |
/**
|
|
732 |
* @brief
|
|
733 |
* Gets the update method.
|
|
734 |
*
|
|
735 |
* @ retval the update method
|
|
736 |
*/
|
|
737 |
const LEX_STRING *getUpdateMethod() const |
|
738 |
{
|
|
739 |
return update_method; |
|
740 |
}
|
|
741 |
||
742 |
/**
|
|
743 |
* @brief
|
|
744 |
* Gets the delete method.
|
|
745 |
*
|
|
746 |
* @ retval the delete method
|
|
747 |
*/
|
|
748 |
const LEX_STRING *getDeleteMethod() const |
|
749 |
{
|
|
750 |
return delete_method; |
|
751 |
}
|
|
752 |
||
753 |
/**
|
|
754 |
* @brief
|
|
755 |
* Gets the name of the referenced key.
|
|
756 |
*
|
|
757 |
* @ retval the name of the referenced key
|
|
758 |
*/
|
|
759 |
const LEX_STRING *getReferencedKeyName() const |
|
760 |
{
|
|
761 |
return referenced_key_name; |
|
762 |
}
|
|
763 |
||
764 |
/**
|
|
765 |
* @brief
|
|
766 |
* Gets the foreign fields.
|
|
767 |
*
|
|
768 |
* @ retval the foreign fields
|
|
769 |
*/
|
|
770 |
const List<LEX_STRING> &getForeignFields() const |
|
771 |
{
|
|
772 |
return foreign_fields; |
|
773 |
}
|
|
774 |
||
775 |
/**
|
|
776 |
* @brief
|
|
777 |
* Gets the referenced fields.
|
|
778 |
*
|
|
779 |
* @ retval the referenced fields
|
|
780 |
*/
|
|
781 |
const List<LEX_STRING> &getReferencedFields() const |
|
782 |
{
|
|
783 |
return referenced_fields; |
|
784 |
}
|
|
785 |
private: |
|
786 |
/**
|
|
787 |
* The foreign id.
|
|
788 |
*/
|
|
789 |
LEX_STRING *foreign_id; |
|
790 |
/**
|
|
791 |
* The name of the reference database.
|
|
792 |
*/
|
|
793 |
LEX_STRING *referenced_db; |
|
794 |
/**
|
|
795 |
* The name of the reference table.
|
|
796 |
*/
|
|
797 |
LEX_STRING *referenced_table; |
|
798 |
/**
|
|
799 |
* The update method.
|
|
800 |
*/
|
|
801 |
LEX_STRING *update_method; |
|
802 |
/**
|
|
803 |
* The delete method.
|
|
804 |
*/
|
|
805 |
LEX_STRING *delete_method; |
|
806 |
/**
|
|
807 |
* The name of the referenced key.
|
|
808 |
*/
|
|
809 |
LEX_STRING *referenced_key_name; |
|
810 |
/**
|
|
811 |
* The foreign fields.
|
|
812 |
*/
|
|
813 |
List<LEX_STRING> foreign_fields; |
|
814 |
/**
|
|
815 |
* The referenced fields.
|
|
816 |
*/
|
|
817 |
List<LEX_STRING> referenced_fields; |
|
818 |
};
|
|
1
by brian
clean slate |
819 |
|
327.2.4
by Brian Aker
Refactoring table.h |
820 |
class TableList; |
1
by brian
clean slate |
821 |
|
1455.6.1
by Yanbo Wu
convert st_foreign_key_info to class ForeignKeyInfo |
822 |
#define JOIN_TYPE_LEFT 1
|
823 |
#define JOIN_TYPE_RIGHT 2
|
|
1
by brian
clean slate |
824 |
|
825 |
struct st_lex; |
|
826 |
class select_union; |
|
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
827 |
class Tmp_Table_Param; |
1
by brian
clean slate |
828 |
|
1241.9.12
by Monty Taylor
Trims more out of server_includes.h. |
829 |
void free_blobs(Table *table); |
830 |
int set_zone(int nr,int min_zone,int max_zone); |
|
831 |
uint32_t convert_period_to_month(uint32_t period); |
|
832 |
uint32_t convert_month_to_period(uint32_t month); |
|
833 |
||
834 |
int test_if_number(char *str,int *res,bool allow_wildcards); |
|
835 |
void change_byte(unsigned char *,uint,char,char); |
|
836 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
837 |
namespace optimizer { class SqlSelect; } |
1241.9.12
by Monty Taylor
Trims more out of server_includes.h. |
838 |
|
839 |
void change_double_for_sort(double nr,unsigned char *to); |
|
840 |
double my_double_round(double value, int64_t dec, bool dec_unsigned, |
|
841 |
bool truncate); |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
842 |
int get_quick_record(optimizer::SqlSelect *select); |
1241.9.12
by Monty Taylor
Trims more out of server_includes.h. |
843 |
|
844 |
void find_date(char *pos,uint32_t *vek,uint32_t flag); |
|
845 |
TYPELIB *convert_strings_to_array_type(char * *typelibs, char * *end); |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
846 |
TYPELIB *typelib(memory::Root *mem_root, List<String> &strings); |
1241.9.12
by Monty Taylor
Trims more out of server_includes.h. |
847 |
ulong get_form_pos(int file, unsigned char *head, TYPELIB *save_names); |
848 |
void append_unescaped(String *res, const char *pos, uint32_t length); |
|
1241.9.15
by Monty Taylor
Moved last of the global function decls out of server_includes.h. |
849 |
|
2119.4.1
by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by |
850 |
DRIZZLED_API int rename_file_ext(const char * from,const char * to,const char * ext); |
1241.9.15
by Monty Taylor
Moved last of the global function decls out of server_includes.h. |
851 |
bool check_column_name(const char *name); |
2087.4.1
by Brian Aker
Merge in schema identifier. |
852 |
bool check_db_name(Session *session, identifier::Schema &schema); |
1241.9.15
by Monty Taylor
Moved last of the global function decls out of server_includes.h. |
853 |
bool check_table_name(const char *name, uint32_t length); |
854 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
855 |
} /* namespace drizzled */ |
856 |
||
2069.4.2
by Brian Aker
Clear up naming convention for table type. |
857 |
#include "drizzled/table/singular.h" |
1843.8.5
by Brian Aker
Added concurrent type. |
858 |
#include "drizzled/table/concurrent.h" |
1843.8.3
by Brian Aker
Break out table types (first pass). |
859 |
|
327.1.2
by Brian Aker
Commiting next pass of Table class cleanup. |
860 |
#endif /* DRIZZLED_TABLE_H */ |