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 |
*
|
|
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 |
*/
|
|
1
by brian
clean slate |
19 |
|
20 |
/*
|
|
21 |
Because of the function new_field() all field classes that have static
|
|
22 |
variables must declare the size_of() member function.
|
|
23 |
*/
|
|
24 |
||
520.8.2
by Monty Taylor
Moved sql_parse.h and sql_error.h out of common_includes. |
25 |
#ifndef DRIZZLED_FIELD_H
|
26 |
#define DRIZZLED_FIELD_H
|
|
27 |
||
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
28 |
#include "drizzled/sql_error.h" |
29 |
#include "drizzled/my_decimal.h" |
|
30 |
#include "drizzled/key_map.h" |
|
31 |
#include "drizzled/sql_bitmap.h" |
|
32 |
#include "drizzled/sql_list.h" |
|
33 |
#include "drizzled/structs.h" |
|
34 |
||
656.1.1
by Monty Taylor
OOOh doggie. Got rid of my_alloca. |
35 |
#include <string> |
1052.2.5
by Nathan Williams
Changed container from list to vector for CreateField::interval_list. There is never inserts into the middle of the container, only push_back. Per jaypipes suggestion. |
36 |
#include <vector> |
1
by brian
clean slate |
37 |
|
38 |
#define DATETIME_DEC 6
|
|
173.1.9
by Toru Maesaka
ripped out DOUBLE and moved to field/ |
39 |
#define DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE FLOATING_POINT_BUFFER
|
1091
by Brian Aker
Collection of patches from new-cleanup (includes asserts for field in debug) |
40 |
|
41 |
#ifdef DEBUG
|
|
1089.1.3
by Brian Aker
Fix protobuf to release memory. Add in assert() for wrong column usage. Fix |
42 |
#define ASSERT_COLUMN_MARKED_FOR_READ assert(!table || (table->read_set == NULL || isReadSet()))
|
43 |
#define ASSERT_COLUMN_MARKED_FOR_WRITE assert(!table || (table->write_set == NULL || isWriteSet()))
|
|
1091
by Brian Aker
Collection of patches from new-cleanup (includes asserts for field in debug) |
44 |
#else
|
45 |
#define ASSERT_COLUMN_MARKED_FOR_READ
|
|
46 |
#define ASSERT_COLUMN_MARKED_FOR_WRITE
|
|
47 |
#endif
|
|
173.1.9
by Toru Maesaka
ripped out DOUBLE and moved to field/ |
48 |
|
205
by Brian Aker
uint32 -> uin32_t |
49 |
const uint32_t max_field_size= (uint32_t) 4294967295U; |
1
by brian
clean slate |
50 |
|
1052.2.4
by Nathan Williams
No actual code changes. Changed Send_field to SendField to be consistent with coding standards. |
51 |
class SendField; |
1052.2.3
by Nathan Williams
No actual code changes. Changed Create_field to CreateField to be consistent with coding standards. |
52 |
class CreateField; |
1000.1.3
by Brian Aker
Renamed TABLE_SHARE to TableShare |
53 |
class TableShare; |
798.2.29
by Brian Aker
Detangle more of the session object |
54 |
class Field; |
1
by brian
clean slate |
55 |
struct st_cache_field; |
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
56 |
|
1
by brian
clean slate |
57 |
int field_conv(Field *to,Field *from); |
58 |
||
438.1.13
by Brian Aker
uint cleanup. |
59 |
inline uint32_t get_enum_pack_length(int elements) |
1
by brian
clean slate |
60 |
{
|
61 |
return elements < 256 ? 1 : 2; |
|
62 |
}
|
|
63 |
||
1055.2.4
by Jay Pipes
Style, indentation, and doxygen/documentation cleanup on Field class. Removal of dead methods in Field such as do_last_null_byte(), last_null_byte() and anonymous enum with LAST_NULL_BYTE_UNDEF... |
64 |
/**
|
65 |
* Class representing a Field in a Table
|
|
66 |
*
|
|
67 |
* @details
|
|
68 |
*
|
|
69 |
* The value stored in the Field object is stored in the
|
|
70 |
* unsigned char pointer member variable called ptr. The
|
|
71 |
* val_xxx() methods retrieve this raw byte value and
|
|
72 |
* convert the byte into the appropriate output (int, decimal, etc).
|
|
73 |
*
|
|
74 |
* The store_xxx() methods take various input and convert
|
|
75 |
* the input into the raw bytes stored in the ptr member variable.
|
|
76 |
*/
|
|
1
by brian
clean slate |
77 |
class Field |
78 |
{
|
|
1055.2.4
by Jay Pipes
Style, indentation, and doxygen/documentation cleanup on Field class. Removal of dead methods in Field such as do_last_null_byte(), last_null_byte() and anonymous enum with LAST_NULL_BYTE_UNDEF... |
79 |
/* Prevent use of these */
|
1110.1.3
by Monty Taylor
Added ListenHandler as a member of PluginRegistry. |
80 |
Field(const Field&); |
1
by brian
clean slate |
81 |
void operator=(Field &); |
82 |
public: |
|
1055.2.4
by Jay Pipes
Style, indentation, and doxygen/documentation cleanup on Field class. Removal of dead methods in Field such as do_last_null_byte(), last_null_byte() and anonymous enum with LAST_NULL_BYTE_UNDEF... |
83 |
unsigned char *ptr; /**< Position to field in record. Stores raw field value */ |
84 |
unsigned char *null_ptr; /**< Byte where null_bit is */ |
|
85 |
||
86 |
/**
|
|
87 |
* Pointer to the Table object containing this Field
|
|
88 |
*
|
|
89 |
* @note You can use table->in_use as replacement for current_session member
|
|
90 |
* only inside of val_*() and store() members (e.g. you can't use it in cons)
|
|
91 |
*/
|
|
92 |
Table *table; |
|
93 |
Table *orig_table; /**< Pointer to the original Table. @TODO What is "the original table"? */ |
|
94 |
const char **table_name; /**< Pointer to the name of the table. @TODO This is redundant with Table::table_name. */ |
|
95 |
const char *field_name; /**< Name of the field */ |
|
96 |
LEX_STRING comment; /**< A comment about the field */ |
|
97 |
||
98 |
/** The field is part of the following keys */
|
|
99 |
key_map key_start; |
|
100 |
key_map part_of_key; |
|
101 |
key_map part_of_key_not_clustered; |
|
102 |
key_map part_of_sortkey; |
|
103 |
||
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
104 |
/*
|
105 |
We use three additional unireg types for TIMESTAMP to overcome limitation
|
|
106 |
of current binary format of .frm file. We'd like to be able to support
|
|
107 |
NOW() as default and on update value for such fields but unable to hold
|
|
1
by brian
clean slate |
108 |
this info anywhere except unireg_check field. This issue will be resolved
|
109 |
in more clean way with transition to new text based .frm format.
|
|
110 |
See also comment for Field_timestamp::Field_timestamp().
|
|
111 |
*/
|
|
1055.2.4
by Jay Pipes
Style, indentation, and doxygen/documentation cleanup on Field class. Removal of dead methods in Field such as do_last_null_byte(), last_null_byte() and anonymous enum with LAST_NULL_BYTE_UNDEF... |
112 |
enum utype |
113 |
{
|
|
114 |
NONE, |
|
115 |
NEXT_NUMBER, |
|
116 |
TIMESTAMP_OLD_FIELD, |
|
117 |
TIMESTAMP_DN_FIELD, |
|
118 |
TIMESTAMP_UN_FIELD, |
|
119 |
TIMESTAMP_DNUN_FIELD
|
|
120 |
};
|
|
1
by brian
clean slate |
121 |
|
1055.2.4
by Jay Pipes
Style, indentation, and doxygen/documentation cleanup on Field class. Removal of dead methods in Field such as do_last_null_byte(), last_null_byte() and anonymous enum with LAST_NULL_BYTE_UNDEF... |
122 |
utype unireg_check; |
123 |
uint32_t field_length; /**< Length of this field in bytes */ |
|
124 |
uint32_t flags; |
|
125 |
uint16_t field_index; /**< Index of this Field in Table::fields array */ |
|
126 |
unsigned char null_bit; /**< Bit used to test null bit */ |
|
1
by brian
clean slate |
127 |
/**
|
128 |
If true, this field was created in create_tmp_field_from_item from a NULL
|
|
129 |
value. This means that the type of the field is just a guess, and the type
|
|
130 |
may be freely coerced to another type.
|
|
131 |
||
132 |
@see create_tmp_field_from_item
|
|
133 |
@see Item_type_holder::get_real_type
|
|
134 |
*/
|
|
135 |
bool is_created_from_null_item; |
|
136 |
||
1055.2.4
by Jay Pipes
Style, indentation, and doxygen/documentation cleanup on Field class. Removal of dead methods in Field such as do_last_null_byte(), last_null_byte() and anonymous enum with LAST_NULL_BYTE_UNDEF... |
137 |
static void *operator new(size_t size) {return sql_alloc(size); } |
138 |
static void *operator new(size_t size, MEM_ROOT *mem_root) |
|
139 |
{ return (void*) alloc_root(mem_root, (uint32_t) size); } |
|
140 |
static void operator delete(void *, size_t) |
|
141 |
{ TRASH(ptr_arg, size); } |
|
142 |
||
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
143 |
Field(unsigned char *ptr_arg, |
144 |
uint32_t length_arg, |
|
145 |
unsigned char *null_ptr_arg, |
|
146 |
unsigned char null_bit_arg, |
|
147 |
utype unireg_check_arg, |
|
1
by brian
clean slate |
148 |
const char *field_name_arg); |
149 |
virtual ~Field() {} |
|
150 |
/* Store functions returns 1 on overflow and -1 on fatal error */
|
|
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
151 |
virtual int store(const char *to, |
152 |
uint32_t length, |
|
779.3.18
by Monty Taylor
Cleaned up warnings up through innodb. |
153 |
const CHARSET_INFO * const cs)=0; |
154 |
virtual int store(double nr)=0; |
|
155 |
virtual int store(int64_t nr, bool unsigned_val)=0; |
|
156 |
virtual int store_decimal(const my_decimal *d)=0; |
|
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
157 |
int store(const char *to, |
158 |
uint32_t length, |
|
779.3.18
by Monty Taylor
Cleaned up warnings up through innodb. |
159 |
const CHARSET_INFO * const cs, |
160 |
enum_check_fields check_level); |
|
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
161 |
/**
|
162 |
This is called when storing a date in a string.
|
|
163 |
||
164 |
@note
|
|
165 |
Needs to be changed if/when we want to support different time formats.
|
|
166 |
*/
|
|
167 |
virtual int store_time(DRIZZLE_TIME *ltime, enum enum_drizzle_timestamp_type t_type); |
|
1
by brian
clean slate |
168 |
virtual double val_real(void)=0; |
152
by Brian Aker
longlong replacement |
169 |
virtual int64_t val_int(void)=0; |
1
by brian
clean slate |
170 |
virtual my_decimal *val_decimal(my_decimal *); |
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
171 |
inline String *val_str(String *str) |
172 |
{
|
|
173 |
return val_str(str, str); |
|
174 |
}
|
|
1
by brian
clean slate |
175 |
/*
|
176 |
val_str(buf1, buf2) gets two buffers and should use them as follows:
|
|
177 |
if it needs a temp buffer to convert result to string - use buf1
|
|
178 |
example Field_tiny::val_str()
|
|
179 |
if the value exists as a string already - use buf2
|
|
241
by Brian Aker
First pass of CHAR removal. |
180 |
example Field_varstring::val_str() (???)
|
1
by brian
clean slate |
181 |
consequently, buf2 may be created as 'String buf;' - no memory
|
182 |
will be allocated for it. buf1 will be allocated to hold a
|
|
183 |
value if it's too small. Using allocated buffer for buf2 may result in
|
|
184 |
an unnecessary free (and later, may be an alloc).
|
|
185 |
This trickery is used to decrease a number of malloc calls.
|
|
186 |
*/
|
|
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
187 |
virtual String *val_str(String*, String *)=0; |
188 |
/**
|
|
189 |
* Interpret field value as an integer but return the result as a string.
|
|
190 |
*
|
|
191 |
* This is used for printing bit_fields as numbers while debugging.
|
|
192 |
*/
|
|
275
by Brian Aker
Full removal of my_bool from central server. |
193 |
String *val_int_as_str(String *val_buffer, bool unsigned_flag); |
1
by brian
clean slate |
194 |
/*
|
51.1.58
by Jay Pipes
Replace/remove DBUG and standardize TRUE/FALSE. Remove ASSERT_COLUMN_XXX macros, that work will be done on another |
195 |
str_needs_quotes() returns true if the value returned by val_str() needs
|
1
by brian
clean slate |
196 |
to be quoted when used in constructing an SQL query.
|
197 |
*/
|
|
51.1.58
by Jay Pipes
Replace/remove DBUG and standardize TRUE/FALSE. Remove ASSERT_COLUMN_XXX macros, that work will be done on another |
198 |
virtual bool str_needs_quotes() { return false; } |
1
by brian
clean slate |
199 |
virtual Item_result result_type () const=0; |
200 |
virtual Item_result cmp_type () const { return result_type(); } |
|
201 |
virtual Item_result cast_to_int_type () const { return result_type(); } |
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
202 |
/**
|
203 |
Check whether a field type can be partially indexed by a key.
|
|
204 |
||
205 |
This is a static method, rather than a virtual function, because we need
|
|
206 |
to check the type of a non-Field in mysql_alter_table().
|
|
207 |
||
208 |
@param type field type
|
|
209 |
||
210 |
@retval
|
|
211 |
true Type can have a prefixed key
|
|
212 |
@retval
|
|
213 |
false Type can not have a prefixed key
|
|
214 |
*/
|
|
1
by brian
clean slate |
215 |
static bool type_can_have_key_part(enum_field_types); |
1055.2.9
by Jay Pipes
Removes dead get_blob_type_from_length() function. We only have one type of BLOB now... |
216 |
/**
|
217 |
Return type of which can carry value of both given types in UNION result.
|
|
218 |
||
219 |
@param a type for merging
|
|
220 |
@param b type for merging
|
|
221 |
||
222 |
@retval
|
|
223 |
type of field
|
|
224 |
*/
|
|
1
by brian
clean slate |
225 |
static enum_field_types field_type_merge(enum_field_types, enum_field_types); |
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
226 |
|
227 |
/**
|
|
228 |
Detect Item_result by given field type of UNION merge result.
|
|
229 |
||
230 |
@param field_type given field type
|
|
231 |
||
232 |
@return
|
|
233 |
Item_result (type of internal MySQL expression result)
|
|
234 |
*/
|
|
1
by brian
clean slate |
235 |
static Item_result result_merge_type(enum_field_types); |
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
236 |
|
237 |
virtual bool eq(Field *field); |
|
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
238 |
/**
|
1055.2.7
by Jay Pipes
More documentation cleanup for Field class |
239 |
* Returns true if the fields are equally defined
|
240 |
*
|
|
241 |
* @retval
|
|
242 |
* true This Field is equally defined to supplied Field
|
|
243 |
* @retval
|
|
244 |
* false This Field is NOT equally defined to supplied Field
|
|
245 |
*/
|
|
1
by brian
clean slate |
246 |
virtual bool eq_def(Field *field); |
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
247 |
|
1055.2.7
by Jay Pipes
More documentation cleanup for Field class |
248 |
/**
|
249 |
* Returns size (in bytes) used to store field data in memory
|
|
250 |
* (i.e. it returns the maximum size of the field in a row of the table,
|
|
251 |
* which is located in RAM).
|
|
252 |
*/
|
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
253 |
virtual uint32_t pack_length() const; |
1
by brian
clean slate |
254 |
|
1055.2.7
by Jay Pipes
More documentation cleanup for Field class |
255 |
/**
|
256 |
* Returns size (in bytes) used to store field data on
|
|
257 |
* storage (i.e. it returns the maximal size of the field in a row of the
|
|
258 |
* table, which is located on disk).
|
|
259 |
*/
|
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
260 |
virtual uint32_t pack_length_in_rec() const; |
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
261 |
/**
|
262 |
Check to see if field size is compatible with destination.
|
|
263 |
||
264 |
This method is used in row-based replication to verify that the slave's
|
|
265 |
field size is less than or equal to the master's field size. The
|
|
266 |
encoded field metadata (from the master or source) is decoded and compared
|
|
267 |
to the size of this field (the slave or destination).
|
|
268 |
||
269 |
@param field_metadata Encoded size in field metadata
|
|
270 |
||
271 |
@retval 0 if this field's size is < the source field's size
|
|
272 |
@retval 1 if this field's size is >= the source field's size
|
|
273 |
*/
|
|
438.1.13
by Brian Aker
uint cleanup. |
274 |
virtual int compatible_field_size(uint32_t field_metadata); |
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
275 |
virtual uint32_t pack_length_from_metadata(uint32_t field_metadata); |
276 |
||
1
by brian
clean slate |
277 |
/*
|
278 |
This method is used to return the size of the data in a row-based
|
|
279 |
replication row record. The default implementation of returning 0 is
|
|
51.1.58
by Jay Pipes
Replace/remove DBUG and standardize TRUE/FALSE. Remove ASSERT_COLUMN_XXX macros, that work will be done on another |
280 |
designed to allow fields that do not use metadata to return true (1)
|
1
by brian
clean slate |
281 |
from compatible_field_size() which uses this function in the comparison.
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
282 |
The default value for field metadata for fields that do not have
|
1
by brian
clean slate |
283 |
metadata is 0. Thus, 0 == 0 means the fields are compatible in size.
|
284 |
||
285 |
Note: While most classes that override this method return pack_length(),
|
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
286 |
the classes Field_varstring, and Field_blob return
|
1
by brian
clean slate |
287 |
field_length + 1, field_length, and pack_length_no_ptr() respectfully.
|
288 |
*/
|
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
289 |
virtual uint32_t row_pack_length(); |
290 |
virtual int save_field_metadata(unsigned char *first_byte); |
|
1
by brian
clean slate |
291 |
|
1055.2.7
by Jay Pipes
More documentation cleanup for Field class |
292 |
/**
|
293 |
* Return the "real size" of the data in memory.
|
|
294 |
* For varstrings, this does _not_ include the length bytes.
|
|
295 |
*/
|
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
296 |
virtual uint32_t data_length(); |
1055.2.7
by Jay Pipes
More documentation cleanup for Field class |
297 |
/**
|
298 |
* Returns the number of bytes actually used to store the data
|
|
299 |
* of the field. So for a varstring it includes both lenght byte(s) and
|
|
300 |
* string data, and anything after data_length() bytes are unused.
|
|
301 |
*/
|
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
302 |
virtual uint32_t used_length(); |
303 |
virtual uint32_t sort_length() const; |
|
1
by brian
clean slate |
304 |
|
305 |
/**
|
|
306 |
Get the maximum size of the data in packed format.
|
|
307 |
||
308 |
@return Maximum data length of the field when packed using the
|
|
309 |
Field::pack() function.
|
|
310 |
*/
|
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
311 |
virtual uint32_t max_data_length() const; |
312 |
virtual int reset(void); |
|
313 |
virtual void reset_fields(); |
|
314 |
virtual void set_default(); |
|
315 |
virtual bool binary() const; |
|
316 |
virtual bool zero_pack() const; |
|
317 |
virtual enum ha_base_keytype key_type() const; |
|
318 |
virtual uint32_t key_length() const; |
|
1
by brian
clean slate |
319 |
virtual enum_field_types type() const =0; |
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
320 |
virtual enum_field_types real_type() const; |
481
by Brian Aker
Remove all of uchar. |
321 |
inline int cmp(const unsigned char *str) { return cmp(ptr,str); } |
322 |
virtual int cmp_max(const unsigned char *a, const unsigned char *b, |
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
323 |
uint32_t max_len); |
481
by Brian Aker
Remove all of uchar. |
324 |
virtual int cmp(const unsigned char *,const unsigned char *)=0; |
325 |
virtual int cmp_binary(const unsigned char *a,const unsigned char *b, |
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
326 |
uint32_t max_length=UINT32_MAX); |
327 |
virtual int cmp_offset(uint32_t row_offset); |
|
328 |
virtual int cmp_binary_offset(uint32_t row_offset); |
|
329 |
virtual int key_cmp(const unsigned char *a,const unsigned char *b); |
|
330 |
virtual int key_cmp(const unsigned char *str, uint32_t length); |
|
331 |
virtual uint32_t decimals() const; |
|
332 |
||
1
by brian
clean slate |
333 |
/*
|
334 |
Caller beware: sql_type can change str.Ptr, so check
|
|
335 |
ptr() to see if it changed if you are using your own buffer
|
|
336 |
in str and restore it with set() if needed
|
|
337 |
*/
|
|
338 |
virtual void sql_type(String &str) const =0; |
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
339 |
|
340 |
// For new field
|
|
341 |
virtual uint32_t size_of() const =0; |
|
342 |
||
343 |
bool is_null(my_ptrdiff_t row_offset= 0); |
|
344 |
bool is_real_null(my_ptrdiff_t row_offset= 0); |
|
345 |
bool is_null_in_record(const unsigned char *record); |
|
1055.2.9
by Jay Pipes
Removes dead get_blob_type_from_length() function. We only have one type of BLOB now... |
346 |
bool is_null_in_record_with_offset(ptrdiff_t offset); |
347 |
void set_null(ptrdiff_t row_offset= 0); |
|
348 |
void set_notnull(ptrdiff_t row_offset= 0); |
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
349 |
bool maybe_null(void); |
350 |
bool real_maybe_null(void); |
|
1
by brian
clean slate |
351 |
|
1052.2.4
by Nathan Williams
No actual code changes. Changed Send_field to SendField to be consistent with coding standards. |
352 |
virtual void make_field(SendField *); |
481
by Brian Aker
Remove all of uchar. |
353 |
virtual void sort_string(unsigned char *buff,uint32_t length)=0; |
438.1.13
by Brian Aker
uint cleanup. |
354 |
virtual bool optimize_range(uint32_t idx, uint32_t part); |
1055.2.9
by Jay Pipes
Removes dead get_blob_type_from_length() function. We only have one type of BLOB now... |
355 |
/**
|
356 |
* Returns true for fields which, when compared with constant
|
|
357 |
* items, can be casted to int64_t. In this case we will at 'fix_fields'
|
|
358 |
* stage cast the constant items to int64_ts and at the execution stage
|
|
359 |
* use field->val_int() for comparison. Used to optimize clauses like
|
|
360 |
* 'a_column BETWEEN date_const AND date_const'.
|
|
361 |
*/
|
|
1055.2.7
by Jay Pipes
More documentation cleanup for Field class |
362 |
virtual bool can_be_compared_as_int64_t() const |
363 |
{
|
|
364 |
return false; |
|
365 |
}
|
|
1
by brian
clean slate |
366 |
virtual void free() {} |
1055.2.8
by Jay Pipes
Breaks Create_field definition out into its own header file. More documentation and style cleanups around Create_field. |
367 |
virtual Field *new_field(MEM_ROOT *root, |
368 |
Table *new_table, |
|
1
by brian
clean slate |
369 |
bool keep_type); |
327.1.1
by Brian Aker
First pass in encapsulating table (it is now an object, no longer a structure). |
370 |
virtual Field *new_key_field(MEM_ROOT *root, Table *new_table, |
1055.2.8
by Jay Pipes
Breaks Create_field definition out into its own header file. More documentation and style cleanups around Create_field. |
371 |
unsigned char *new_ptr, |
372 |
unsigned char *new_null_ptr, |
|
438.1.13
by Brian Aker
uint cleanup. |
373 |
uint32_t new_null_bit); |
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
374 |
/** This is used to generate a field in Table from TableShare */
|
327.1.1
by Brian Aker
First pass in encapsulating table (it is now an object, no longer a structure). |
375 |
Field *clone(MEM_ROOT *mem_root, Table *new_table); |
481
by Brian Aker
Remove all of uchar. |
376 |
inline void move_field(unsigned char *ptr_arg,unsigned char *null_ptr_arg,unsigned char null_bit_arg) |
1
by brian
clean slate |
377 |
{
|
1055.2.8
by Jay Pipes
Breaks Create_field definition out into its own header file. More documentation and style cleanups around Create_field. |
378 |
ptr= ptr_arg; |
379 |
null_ptr= null_ptr_arg; |
|
380 |
null_bit= null_bit_arg; |
|
1
by brian
clean slate |
381 |
}
|
481
by Brian Aker
Remove all of uchar. |
382 |
inline void move_field(unsigned char *ptr_arg) { ptr=ptr_arg; } |
1055.2.8
by Jay Pipes
Breaks Create_field definition out into its own header file. More documentation and style cleanups around Create_field. |
383 |
virtual void move_field_offset(ptrdiff_t ptr_diff) |
1
by brian
clean slate |
384 |
{
|
1055.2.8
by Jay Pipes
Breaks Create_field definition out into its own header file. More documentation and style cleanups around Create_field. |
385 |
ptr= ADD_TO_PTR(ptr,ptr_diff, unsigned char*); |
1
by brian
clean slate |
386 |
if (null_ptr) |
1055.2.8
by Jay Pipes
Breaks Create_field definition out into its own header file. More documentation and style cleanups around Create_field. |
387 |
null_ptr= ADD_TO_PTR(null_ptr,ptr_diff,unsigned char*); |
1
by brian
clean slate |
388 |
}
|
1055.2.5
by Jay Pipes
Removal of dead Field::image_type and st_key_part::image_type member variables. Legacy from geometry MyISAM types... |
389 |
virtual void get_image(unsigned char *buff, uint32_t length, const CHARSET_INFO * const) |
390 |
{
|
|
391 |
memcpy(buff,ptr,length); |
|
392 |
}
|
|
393 |
virtual void get_image(std::basic_string<unsigned char> &buff, uint32_t length, const CHARSET_INFO * const) |
|
394 |
{
|
|
395 |
buff.append(ptr,length); |
|
396 |
}
|
|
397 |
virtual void set_image(const unsigned char *buff,uint32_t length, const CHARSET_INFO * const) |
|
398 |
{
|
|
399 |
memcpy(ptr,buff,length); |
|
400 |
}
|
|
1
by brian
clean slate |
401 |
|
1055.2.7
by Jay Pipes
More documentation cleanup for Field class |
402 |
/**
|
403 |
* Copy a field part into an output buffer.
|
|
404 |
*
|
|
405 |
* @details
|
|
406 |
*
|
|
407 |
* This function makes a copy of field part of size equal to or
|
|
408 |
* less than "length" parameter value.
|
|
409 |
* For fields of string types (VARCHAR, TEXT) the rest of buffer
|
|
410 |
* is padded by zero byte.
|
|
411 |
*
|
|
412 |
* @param output buffer
|
|
413 |
* @param output buffer size
|
|
414 |
*
|
|
415 |
* @note
|
|
416 |
*
|
|
417 |
* For variable length character fields (i.e. UTF-8) the "length"
|
|
418 |
* parameter means a number of output buffer bytes as if all field
|
|
419 |
* characters have maximal possible size (mbmaxlen). In the other words,
|
|
420 |
* "length" parameter is a number of characters multiplied by
|
|
421 |
* field_charset->mbmaxlen.
|
|
422 |
*
|
|
423 |
* @retval
|
|
424 |
* Number of copied bytes (excluding padded zero bytes -- see above).
|
|
425 |
*/
|
|
1055.2.5
by Jay Pipes
Removal of dead Field::image_type and st_key_part::image_type member variables. Legacy from geometry MyISAM types... |
426 |
virtual uint32_t get_key_image(unsigned char *buff, uint32_t length) |
1
by brian
clean slate |
427 |
{
|
428 |
get_image(buff, length, &my_charset_bin); |
|
429 |
return length; |
|
430 |
}
|
|
1055.2.5
by Jay Pipes
Removal of dead Field::image_type and st_key_part::image_type member variables. Legacy from geometry MyISAM types... |
431 |
virtual uint32_t get_key_image(std::basic_string<unsigned char> &buff, uint32_t length) |
656.1.1
by Monty Taylor
OOOh doggie. Got rid of my_alloca. |
432 |
{
|
433 |
get_image(buff, length, &my_charset_bin); |
|
434 |
return length; |
|
435 |
}
|
|
481
by Brian Aker
Remove all of uchar. |
436 |
virtual void set_key_image(const unsigned char *buff,uint32_t length) |
1055.2.5
by Jay Pipes
Removal of dead Field::image_type and st_key_part::image_type member variables. Legacy from geometry MyISAM types... |
437 |
{
|
438 |
set_image(buff,length, &my_charset_bin); |
|
439 |
}
|
|
438.1.13
by Brian Aker
uint cleanup. |
440 |
inline int64_t val_int_offset(uint32_t row_offset) |
779.3.18
by Monty Taylor
Cleaned up warnings up through innodb. |
441 |
{
|
442 |
ptr+=row_offset; |
|
443 |
int64_t tmp=val_int(); |
|
444 |
ptr-=row_offset; |
|
445 |
return tmp; |
|
446 |
}
|
|
447 |
||
448 |
inline int64_t val_int(const unsigned char *new_ptr) |
|
449 |
{
|
|
450 |
unsigned char *old_ptr= ptr; |
|
451 |
int64_t return_value; |
|
452 |
ptr= (unsigned char*) new_ptr; |
|
453 |
return_value= val_int(); |
|
454 |
ptr= old_ptr; |
|
455 |
return return_value; |
|
456 |
}
|
|
457 |
inline String *val_str(String *str, const unsigned char *new_ptr) |
|
458 |
{
|
|
459 |
unsigned char *old_ptr= ptr; |
|
460 |
ptr= (unsigned char*) new_ptr; |
|
461 |
val_str(str); |
|
462 |
ptr= old_ptr; |
|
463 |
return str; |
|
464 |
}
|
|
465 |
||
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
466 |
/**
|
467 |
Pack the field into a format suitable for storage and transfer.
|
|
468 |
||
469 |
To implement packing functionality, only the virtual function
|
|
470 |
should be overridden. The other functions are just convenience
|
|
471 |
functions and hence should not be overridden.
|
|
472 |
||
473 |
The value of <code>low_byte_first</code> is dependent on how the
|
|
474 |
packed data is going to be used: for local use, e.g., temporary
|
|
475 |
store on disk or in memory, use the native format since that is
|
|
476 |
faster. For data that is going to be transfered to other machines
|
|
477 |
(e.g., when writing data to the binary log), data should always be
|
|
478 |
stored in little-endian format.
|
|
479 |
||
480 |
@note The default method for packing fields just copy the raw bytes
|
|
481 |
of the record into the destination, but never more than
|
|
482 |
<code>max_length</code> characters.
|
|
483 |
||
484 |
@param to
|
|
485 |
Pointer to memory area where representation of field should be put.
|
|
486 |
||
487 |
@param from
|
|
488 |
Pointer to memory area where record representation of field is
|
|
489 |
stored.
|
|
490 |
||
491 |
@param max_length
|
|
492 |
Maximum length of the field, as given in the column definition. For
|
|
493 |
example, for <code>CHAR(1000)</code>, the <code>max_length</code>
|
|
494 |
is 1000. This information is sometimes needed to decide how to pack
|
|
495 |
the data.
|
|
496 |
||
497 |
@param low_byte_first
|
|
498 |
@c true if integers should be stored little-endian, @c false if
|
|
499 |
native format should be used. Note that for little-endian machines,
|
|
500 |
the value of this flag is a moot point since the native format is
|
|
501 |
little-endian.
|
|
502 |
*/
|
|
779.3.16
by Monty Taylor
Some Sun warning fixes. |
503 |
virtual unsigned char *pack(unsigned char *to, |
504 |
const unsigned char *from, |
|
505 |
uint32_t max_length, |
|
506 |
bool low_byte_first); |
|
507 |
||
779.3.18
by Monty Taylor
Cleaned up warnings up through innodb. |
508 |
unsigned char *pack(unsigned char *to, const unsigned char *from); |
1
by brian
clean slate |
509 |
|
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
510 |
/**
|
511 |
Unpack a field from row data.
|
|
512 |
||
513 |
This method is used to unpack a field from a master whose size of
|
|
514 |
the field is less than that of the slave.
|
|
515 |
||
516 |
The <code>param_data</code> parameter is a two-byte integer (stored
|
|
517 |
in the least significant 16 bits of the unsigned integer) usually
|
|
518 |
consisting of two parts: the real type in the most significant byte
|
|
519 |
and a original pack length in the least significant byte.
|
|
520 |
||
521 |
The exact layout of the <code>param_data</code> field is given by
|
|
522 |
the <code>Table_map_log_event::save_field_metadata()</code>.
|
|
523 |
||
524 |
This is the default method for unpacking a field. It just copies
|
|
525 |
the memory block in byte order (of original pack length bytes or
|
|
526 |
length of field, whichever is smaller).
|
|
527 |
||
528 |
@param to Destination of the data
|
|
529 |
@param from Source of the data
|
|
530 |
@param param_data Real type and original pack length of the field
|
|
531 |
data
|
|
532 |
||
533 |
@param low_byte_first
|
|
534 |
If this flag is @c true, all composite entities (e.g., lengths)
|
|
535 |
should be unpacked in little-endian format; otherwise, the entities
|
|
536 |
are unpacked in native order.
|
|
537 |
||
538 |
@return New pointer into memory based on from + length of the data
|
|
539 |
*/
|
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
540 |
virtual const unsigned char *unpack(unsigned char* to, |
541 |
const unsigned char *from, |
|
542 |
uint32_t param_data, |
|
543 |
bool low_byte_first); |
|
1
by brian
clean slate |
544 |
/**
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
545 |
@overload Field::unpack(unsigned char*, const unsigned char*,
|
546 |
uint32_t, bool)
|
|
1
by brian
clean slate |
547 |
*/
|
779.3.18
by Monty Taylor
Cleaned up warnings up through innodb. |
548 |
const unsigned char *unpack(unsigned char* to, |
549 |
const unsigned char *from); |
|
1
by brian
clean slate |
550 |
|
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
551 |
virtual unsigned char *pack_key(unsigned char* to, |
552 |
const unsigned char *from, |
|
553 |
uint32_t max_length, |
|
554 |
bool low_byte_first) |
|
1
by brian
clean slate |
555 |
{
|
556 |
return pack(to, from, max_length, low_byte_first); |
|
557 |
}
|
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
558 |
virtual unsigned char *pack_key_from_key_image(unsigned char* to, |
559 |
const unsigned char *from, |
|
560 |
uint32_t max_length, |
|
561 |
bool low_byte_first) |
|
1
by brian
clean slate |
562 |
{
|
563 |
return pack(to, from, max_length, low_byte_first); |
|
564 |
}
|
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
565 |
virtual const unsigned char *unpack_key(unsigned char* to, |
566 |
const unsigned char *from, |
|
567 |
uint32_t max_length, |
|
568 |
bool low_byte_first) |
|
1
by brian
clean slate |
569 |
{
|
570 |
return unpack(to, from, max_length, low_byte_first); |
|
571 |
}
|
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
572 |
virtual uint32_t packed_col_length(const unsigned char *to, uint32_t length); |
438.1.13
by Brian Aker
uint cleanup. |
573 |
virtual uint32_t max_packed_col_length(uint32_t max_length) |
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
574 |
{
|
575 |
return max_length; |
|
576 |
}
|
|
1
by brian
clean slate |
577 |
|
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
578 |
virtual int pack_cmp(const unsigned char *a, |
579 |
const unsigned char *b, |
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
580 |
uint32_t key_length_arg, |
581 |
bool insert_or_update); |
|
481
by Brian Aker
Remove all of uchar. |
582 |
virtual int pack_cmp(const unsigned char *b, |
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
583 |
uint32_t key_length_arg, |
584 |
bool insert_or_update); |
|
585 |
||
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
586 |
inline uint32_t offset(unsigned char *record) |
1
by brian
clean slate |
587 |
{
|
438.1.13
by Brian Aker
uint cleanup. |
588 |
return (uint32_t) (ptr - record); |
1
by brian
clean slate |
589 |
}
|
590 |
void copy_from_tmp(int offset); |
|
438.1.13
by Brian Aker
uint cleanup. |
591 |
uint32_t fill_cache_field(struct st_cache_field *copy); |
592 |
virtual bool get_date(DRIZZLE_TIME *ltime,uint32_t fuzzydate); |
|
236.1.24
by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME. |
593 |
virtual bool get_time(DRIZZLE_TIME *ltime); |
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
594 |
virtual const CHARSET_INFO *charset(void) const { return &my_charset_bin; } |
595 |
virtual const CHARSET_INFO *sort_charset(void) const { return charset(); } |
|
51.1.58
by Jay Pipes
Replace/remove DBUG and standardize TRUE/FALSE. Remove ASSERT_COLUMN_XXX macros, that work will be done on another |
596 |
virtual bool has_charset(void) const { return false; } |
644
by Brian Aker
Clean up warnings for Solaris. |
597 |
virtual void set_charset(const CHARSET_INFO * const) |
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
598 |
{}
|
1
by brian
clean slate |
599 |
virtual enum Derivation derivation(void) const |
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
600 |
{
|
601 |
return DERIVATION_IMPLICIT; |
|
602 |
}
|
|
644
by Brian Aker
Clean up warnings for Solaris. |
603 |
virtual void set_derivation(enum Derivation) |
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
604 |
{}
|
605 |
/**
|
|
606 |
Produce warning or note about data saved into field.
|
|
607 |
||
608 |
@param level - level of message (Note/Warning/Error)
|
|
609 |
@param code - error code of message to be produced
|
|
610 |
@param cuted_increment - whenever we should increase cut fields count or not
|
|
611 |
||
612 |
@note
|
|
613 |
This function won't produce warning and increase cut fields counter
|
|
614 |
if count_cuted_fields == CHECK_FIELD_IGNORE for current thread.
|
|
615 |
||
616 |
if count_cuted_fields == CHECK_FIELD_IGNORE then we ignore notes.
|
|
617 |
This allows us to avoid notes in optimisation, like convert_constant_item().
|
|
618 |
||
619 |
@retval
|
|
620 |
1 if count_cuted_fields == CHECK_FIELD_IGNORE and error level is not NOTE
|
|
621 |
@retval
|
|
622 |
0 otherwise
|
|
623 |
*/
|
|
624 |
bool set_warning(DRIZZLE_ERROR::enum_warning_level, |
|
625 |
unsigned int code, |
|
1
by brian
clean slate |
626 |
int cuted_increment); |
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
627 |
/**
|
628 |
Produce warning or note about datetime string data saved into field.
|
|
629 |
||
630 |
@param level level of message (Note/Warning/Error)
|
|
631 |
@param code error code of message to be produced
|
|
632 |
@param str string value which we tried to save
|
|
633 |
@param str_length length of string which we tried to save
|
|
634 |
@param ts_type type of datetime value (datetime/date/time)
|
|
635 |
@param cuted_increment whenever we should increase cut fields count or not
|
|
636 |
||
637 |
@note
|
|
638 |
This function will always produce some warning but won't increase cut
|
|
639 |
fields counter if count_cuted_fields ==FIELD_CHECK_IGNORE for current
|
|
640 |
thread.
|
|
641 |
*/
|
|
642 |
void set_datetime_warning(DRIZZLE_ERROR::enum_warning_level, |
|
643 |
uint32_t code, |
|
644 |
const char *str, |
|
645 |
uint32_t str_len, |
|
646 |
enum enum_drizzle_timestamp_type ts_type, |
|
647 |
int cuted_increment); |
|
648 |
/**
|
|
649 |
Produce warning or note about integer datetime value saved into field.
|
|
650 |
||
651 |
@param level level of message (Note/Warning/Error)
|
|
652 |
@param code error code of message to be produced
|
|
653 |
@param nr numeric value which we tried to save
|
|
654 |
@param ts_type type of datetime value (datetime/date/time)
|
|
655 |
@param cuted_increment whenever we should increase cut fields count or not
|
|
656 |
||
657 |
@note
|
|
658 |
This function will always produce some warning but won't increase cut
|
|
659 |
fields counter if count_cuted_fields == FIELD_CHECK_IGNORE for current
|
|
660 |
thread.
|
|
661 |
*/
|
|
662 |
void set_datetime_warning(DRIZZLE_ERROR::enum_warning_level, |
|
663 |
uint32_t code, |
|
664 |
int64_t nr, |
|
665 |
enum enum_drizzle_timestamp_type ts_type, |
|
666 |
int cuted_increment); |
|
667 |
/**
|
|
668 |
Produce warning or note about double datetime data saved into field.
|
|
669 |
||
670 |
@param level level of message (Note/Warning/Error)
|
|
671 |
@param code error code of message to be produced
|
|
672 |
@param nr double value which we tried to save
|
|
673 |
@param ts_type type of datetime value (datetime/date/time)
|
|
674 |
||
675 |
@note
|
|
676 |
This function will always produce some warning but won't increase cut
|
|
677 |
fields counter if count_cuted_fields == FIELD_CHECK_IGNORE for current
|
|
678 |
thread.
|
|
679 |
*/
|
|
680 |
void set_datetime_warning(DRIZZLE_ERROR::enum_warning_level, |
|
681 |
const uint32_t code, |
|
682 |
double nr, |
|
683 |
enum enum_drizzle_timestamp_type ts_type); |
|
1
by brian
clean slate |
684 |
inline bool check_overflow(int op_result) |
685 |
{
|
|
686 |
return (op_result == E_DEC_OVERFLOW); |
|
687 |
}
|
|
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
688 |
/**
|
689 |
Process decimal library return codes and issue warnings for overflow and
|
|
690 |
truncation.
|
|
691 |
||
692 |
@param op_result decimal library return code (E_DEC_* see include/decimal.h)
|
|
693 |
||
694 |
@retval
|
|
695 |
E_DEC_OVERFLOW there was overflow
|
|
696 |
E_DEC_TRUNCATED there was truncation
|
|
697 |
@retval
|
|
698 |
0 no error or there was some other error except overflow or truncation
|
|
699 |
*/
|
|
1
by brian
clean slate |
700 |
int warn_if_overflow(int op_result); |
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
701 |
void init(Table *table_arg); |
1
by brian
clean slate |
702 |
|
703 |
/* maximum possible display length */
|
|
205
by Brian Aker
uint32 -> uin32_t |
704 |
virtual uint32_t max_display_length()= 0; |
1
by brian
clean slate |
705 |
|
1052.2.3
by Nathan Williams
No actual code changes. Changed Create_field to CreateField to be consistent with coding standards. |
706 |
virtual uint32_t is_equal(CreateField *new_field); |
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
707 |
/**
|
708 |
Conversion from decimal to int64_t with checking overflow and
|
|
709 |
setting correct value (min/max) in case of overflow.
|
|
710 |
||
711 |
@param val value which have to be converted
|
|
712 |
@param unsigned_flag type of integer in which we convert val
|
|
713 |
@param err variable to pass error code
|
|
714 |
||
715 |
@return
|
|
716 |
value converted from val
|
|
717 |
*/
|
|
718 |
int64_t convert_decimal2int64_t(const my_decimal *val, |
|
719 |
bool unsigned_flag, |
|
720 |
int *err); |
|
1
by brian
clean slate |
721 |
/* The max. number of characters */
|
205
by Brian Aker
uint32 -> uin32_t |
722 |
inline uint32_t char_length() const |
1
by brian
clean slate |
723 |
{
|
724 |
return field_length / charset()->mbmaxlen; |
|
725 |
}
|
|
726 |
||
727 |
inline enum column_format_type column_format() const |
|
728 |
{
|
|
729 |
return (enum column_format_type) |
|
730 |
((flags >> COLUMN_FORMAT_FLAGS) & COLUMN_FORMAT_MASK); |
|
731 |
}
|
|
732 |
||
733 |
/* Hash value */
|
|
290
by Brian Aker
Update for ulong change over. |
734 |
virtual void hash(uint32_t *nr, uint32_t *nr2); |
520.1.21
by Brian Aker
THD -> Session rename |
735 |
friend bool reopen_table(Session *,Table *,bool); |
1052.2.7
by Nathan Williams
Merged trunk and resolved conflicts. |
736 |
|
1052.2.2
by Nathan Williams
No actual code changes. Changed Copy_field to CopyField, to reflect the coding standards. |
737 |
friend class CopyField; |
1
by brian
clean slate |
738 |
friend class Item_avg_field; |
739 |
friend class Item_std_field; |
|
740 |
friend class Item_sum_num; |
|
741 |
friend class Item_sum_sum; |
|
742 |
friend class Item_sum_str; |
|
743 |
friend class Item_sum_count; |
|
744 |
friend class Item_sum_avg; |
|
745 |
friend class Item_sum_std; |
|
746 |
friend class Item_sum_min; |
|
747 |
friend class Item_sum_max; |
|
748 |
friend class Item_func_group_concat; |
|
749 |
||
1003.1.9
by Brian Aker
Patches for Jay (aka name changes) |
750 |
bool isReadSet(); |
751 |
bool isWriteSet(); |
|
1089.1.3
by Brian Aker
Fix protobuf to release memory. Add in assert() for wrong column usage. Fix |
752 |
void setReadSet(bool arg= true); |
753 |
void setWriteSet(bool arg= true); |
|
1003.1.6
by Brian Aker
Added interface for field to get read/write on its own. |
754 |
|
1
by brian
clean slate |
755 |
private: |
756 |
||
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
757 |
/**
|
758 |
Retrieve the field metadata for fields.
|
|
759 |
||
760 |
This default implementation returns 0 and saves 0 in the metadata_ptr
|
|
761 |
value.
|
|
762 |
||
763 |
@param metadata_ptr First byte of field metadata
|
|
764 |
||
765 |
@returns 0 no bytes written.
|
|
766 |
*/
|
|
644
by Brian Aker
Clean up warnings for Solaris. |
767 |
virtual int do_save_field_metadata(unsigned char *) |
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
768 |
{
|
769 |
return 0; |
|
770 |
}
|
|
1
by brian
clean slate |
771 |
};
|
772 |
||
1055.2.8
by Jay Pipes
Breaks Create_field definition out into its own header file. More documentation and style cleanups around Create_field. |
773 |
#include "drizzled/create_field.h" |
774 |
||
775 |
/**
|
|
776 |
* A class for sending field information to a client.
|
|
777 |
*
|
|
778 |
* @details
|
|
779 |
*
|
|
780 |
* Send_field is basically a stripped-down POD class for
|
|
781 |
* representing basic information about a field...
|
|
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
782 |
*/
|
1052.2.7
by Nathan Williams
Merged trunk and resolved conflicts. |
783 |
class SendField |
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
784 |
{
|
785 |
public: |
|
1
by brian
clean slate |
786 |
const char *db_name; |
1055.2.8
by Jay Pipes
Breaks Create_field definition out into its own header file. More documentation and style cleanups around Create_field. |
787 |
const char *table_name; |
788 |
const char *org_table_name; |
|
789 |
const char *col_name; |
|
790 |
const char *org_col_name; |
|
290
by Brian Aker
Update for ulong change over. |
791 |
uint32_t length; |
1055.2.8
by Jay Pipes
Breaks Create_field definition out into its own header file. More documentation and style cleanups around Create_field. |
792 |
uint32_t charsetnr; |
793 |
uint32_t flags; |
|
794 |
uint32_t decimals; |
|
1
by brian
clean slate |
795 |
enum_field_types type; |
1052.2.4
by Nathan Williams
No actual code changes. Changed Send_field to SendField to be consistent with coding standards. |
796 |
SendField() {} |
1
by brian
clean slate |
797 |
};
|
798 |
||
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
799 |
/**
|
800 |
* A class for quick copying data to fields
|
|
801 |
*/
|
|
1052.2.7
by Nathan Williams
Merged trunk and resolved conflicts. |
802 |
class CopyField :public Sql_alloc |
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
803 |
{
|
1
by brian
clean slate |
804 |
/**
|
805 |
Convenience definition of a copy function returned by
|
|
806 |
get_copy_func.
|
|
807 |
*/
|
|
1052.2.2
by Nathan Williams
No actual code changes. Changed Copy_field to CopyField, to reflect the coding standards. |
808 |
typedef void Copy_func(CopyField*); |
1
by brian
clean slate |
809 |
Copy_func *get_copy_func(Field *to, Field *from); |
810 |
public: |
|
1055.2.8
by Jay Pipes
Breaks Create_field definition out into its own header file. More documentation and style cleanups around Create_field. |
811 |
unsigned char *from_ptr; |
812 |
unsigned char *to_ptr; |
|
813 |
unsigned char *from_null_ptr; |
|
814 |
unsigned char *to_null_ptr; |
|
274
by Brian Aker
my_bool conversion in Table |
815 |
bool *null_row; |
1055.2.8
by Jay Pipes
Breaks Create_field definition out into its own header file. More documentation and style cleanups around Create_field. |
816 |
uint32_t from_bit; |
817 |
uint32_t to_bit; |
|
818 |
uint32_t from_length; |
|
819 |
uint32_t to_length; |
|
820 |
Field *from_field; |
|
821 |
Field *to_field; |
|
1
by brian
clean slate |
822 |
String tmp; // For items |
823 |
||
1052.2.2
by Nathan Williams
No actual code changes. Changed Copy_field to CopyField, to reflect the coding standards. |
824 |
CopyField() {} |
825 |
~CopyField() {} |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
826 |
void set(Field *to,Field *from,bool save); // Field to field |
481
by Brian Aker
Remove all of uchar. |
827 |
void set(unsigned char *to,Field *from); // Field to string |
1052.2.2
by Nathan Williams
No actual code changes. Changed Copy_field to CopyField, to reflect the coding standards. |
828 |
void (*do_copy)(CopyField *); |
829 |
void (*do_copy2)(CopyField *); // Used to handle null values |
|
1
by brian
clean slate |
830 |
};
|
831 |
||
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
832 |
Field *make_field(TableShare *share, |
833 |
MEM_ROOT *root, |
|
834 |
unsigned char *ptr, |
|
835 |
uint32_t field_length, |
|
836 |
unsigned char *null_pos, |
|
837 |
unsigned char null_bit, |
|
838 |
uint32_t pack_flag, |
|
839 |
enum_field_types field_type, |
|
575.4.7
by Monty Taylor
More header cleanup. |
840 |
const CHARSET_INFO * cs, |
841 |
Field::utype unireg_check, |
|
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
842 |
TYPELIB *interval, |
843 |
const char *field_name); |
|
575.4.7
by Monty Taylor
More header cleanup. |
844 |
|
438.1.13
by Brian Aker
uint cleanup. |
845 |
uint32_t pack_length_to_packflag(uint32_t type); |
205
by Brian Aker
uint32 -> uin32_t |
846 |
uint32_t calc_pack_length(enum_field_types type,uint32_t length); |
1
by brian
clean slate |
847 |
int set_field_to_null(Field *field); |
848 |
int set_field_to_null_with_conversions(Field *field, bool no_conversions); |
|
849 |
||
1055.2.7
by Jay Pipes
More documentation cleanup for Field class |
850 |
/**
|
851 |
* Tests if the given string contains important data:
|
|
852 |
* not spaces for character string, or any data for binary string.
|
|
853 |
*
|
|
854 |
* @param pointer to the character set to use
|
|
855 |
* @param String to test
|
|
856 |
* @param String end
|
|
857 |
*
|
|
858 |
* @retval
|
|
859 |
* false - If string does not have important data
|
|
860 |
* @retval
|
|
861 |
* true - If string has some important data
|
|
862 |
*/
|
|
1055.2.6
by Jay Pipes
Style cleanup in field.cc and move documentation into Field class in header file. |
863 |
bool test_if_important_data(const CHARSET_INFO * const cs, |
864 |
const char *str, |
|
865 |
const char *strend); |
|
520.8.2
by Monty Taylor
Moved sql_parse.h and sql_error.h out of common_includes. |
866 |
|
867 |
#endif /* DRIZZLED_FIELD_H */ |