173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
1 |
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 MySQL
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; either version 2 of the License, or
|
|
9 |
* (at your option) any later version.
|
|
10 |
*
|
|
11 |
* This program is distributed in the hope that it will be useful,
|
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
* GNU General Public License for more details.
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License
|
|
17 |
* along with this program; if not, write to the Free Software
|
|
18 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
19 |
*/
|
|
20 |
||
21 |
#ifndef DRIZZLE_SERVER_FIELD_VARSTRING
|
|
22 |
#define DRIZZLE_SERVER_FIELD_VARSTRING
|
|
23 |
||
24 |
class Field_varstring :public Field_longstr { |
|
25 |
public: |
|
26 |
/*
|
|
27 |
The maximum space available in a Field_varstring, in bytes. See
|
|
28 |
length_bytes.
|
|
29 |
*/
|
|
30 |
static const uint MAX_SIZE; |
|
31 |
/* Store number of bytes used to store length (1 or 2) */
|
|
205
by Brian Aker
uint32 -> uin32_t |
32 |
uint32_t length_bytes; |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
33 |
Field_varstring(uchar *ptr_arg, |
205
by Brian Aker
uint32 -> uin32_t |
34 |
uint32_t len_arg, uint length_bytes_arg, |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
35 |
uchar *null_ptr_arg, uchar null_bit_arg, |
36 |
enum utype unireg_check_arg, const char *field_name_arg, |
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
37 |
TABLE_SHARE *share, const CHARSET_INFO * const cs) |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
38 |
:Field_longstr(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, |
39 |
unireg_check_arg, field_name_arg, cs), |
|
40 |
length_bytes(length_bytes_arg) |
|
41 |
{
|
|
42 |
share->varchar_fields++; |
|
43 |
}
|
|
205
by Brian Aker
uint32 -> uin32_t |
44 |
Field_varstring(uint32_t len_arg,bool maybe_null_arg, |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
45 |
const char *field_name_arg, |
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
46 |
TABLE_SHARE *share, const CHARSET_INFO * const cs) |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
47 |
:Field_longstr((uchar*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0, 0, |
48 |
NONE, field_name_arg, cs), |
|
49 |
length_bytes(len_arg < 256 ? 1 :2) |
|
50 |
{
|
|
51 |
share->varchar_fields++; |
|
52 |
}
|
|
53 |
||
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
54 |
enum_field_types type() const { return DRIZZLE_TYPE_VARCHAR; } |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
55 |
enum ha_base_keytype key_type() const; |
56 |
uint row_pack_length() { return field_length; } |
|
57 |
bool zero_pack() const { return 0; } |
|
212.6.1
by Mats Kindahl
Replacing all bzero() calls with memset() calls and removing the bzero.c file. |
58 |
int reset(void) { memset(ptr, 0, field_length+length_bytes); return 0; } |
205
by Brian Aker
uint32 -> uin32_t |
59 |
uint32_t pack_length() const { return (uint32_t) field_length+length_bytes; } |
60 |
uint32_t key_length() const { return (uint32_t) field_length; } |
|
61 |
uint32_t sort_length() const |
|
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
62 |
{
|
205
by Brian Aker
uint32 -> uin32_t |
63 |
return (uint32_t) field_length + (field_charset == &my_charset_bin ? |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
64 |
length_bytes : 0); |
65 |
}
|
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
66 |
int store(const char *to,uint length, const CHARSET_INFO * const charset); |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
67 |
int store(int64_t nr, bool unsigned_val); |
68 |
int store(double nr) { return Field_str::store(nr); } /* QQ: To be deleted */ |
|
69 |
double val_real(void); |
|
70 |
int64_t val_int(void); |
|
71 |
String *val_str(String*,String *); |
|
72 |
my_decimal *val_decimal(my_decimal *); |
|
365.2.6
by Monty Taylor
Undid some stupid int->int16_t conversions. |
73 |
int cmp_max(const uchar *, const uchar *, uint32_t max_length); |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
74 |
int cmp(const uchar *a,const uchar *b) |
75 |
{
|
|
365.2.6
by Monty Taylor
Undid some stupid int->int16_t conversions. |
76 |
return cmp_max(a, b, UINT32_MAX); |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
77 |
}
|
78 |
void sort_string(uchar *buff,uint length); |
|
79 |
uint get_key_image(uchar *buff,uint length, imagetype type); |
|
80 |
void set_key_image(const uchar *buff,uint length); |
|
81 |
void sql_type(String &str) const; |
|
82 |
virtual uchar *pack(uchar *to, const uchar *from, |
|
83 |
uint max_length, bool low_byte_first); |
|
84 |
uchar *pack_key(uchar *to, const uchar *from, uint max_length, bool low_byte_first); |
|
85 |
uchar *pack_key_from_key_image(uchar* to, const uchar *from, |
|
86 |
uint max_length, bool low_byte_first); |
|
87 |
virtual const uchar *unpack(uchar* to, const uchar *from, |
|
88 |
uint param_data, bool low_byte_first); |
|
89 |
const uchar *unpack_key(uchar* to, const uchar *from, |
|
90 |
uint max_length, bool low_byte_first); |
|
91 |
int pack_cmp(const uchar *a, const uchar *b, uint key_length, |
|
275
by Brian Aker
Full removal of my_bool from central server. |
92 |
bool insert_or_update); |
93 |
int pack_cmp(const uchar *b, uint key_length,bool insert_or_update); |
|
205
by Brian Aker
uint32 -> uin32_t |
94 |
int cmp_binary(const uchar *a,const uchar *b, uint32_t max_length=~0L); |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
95 |
int key_cmp(const uchar *,const uchar*); |
96 |
int key_cmp(const uchar *str, uint length); |
|
97 |
uint packed_col_length(const uchar *to, uint length); |
|
98 |
uint max_packed_col_length(uint max_length); |
|
205
by Brian Aker
uint32 -> uin32_t |
99 |
uint32_t data_length(); |
100 |
uint32_t used_length(); |
|
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
101 |
uint size_of() const { return sizeof(*this); } |
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
102 |
enum_field_types real_type() const { return DRIZZLE_TYPE_VARCHAR; } |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
103 |
bool has_charset(void) const |
104 |
{ return charset() == &my_charset_bin ? false : true; } |
|
327.1.1
by Brian Aker
First pass in encapsulating table (it is now an object, no longer a structure). |
105 |
Field *new_field(MEM_ROOT *root, Table *new_table, bool keep_type); |
106 |
Field *new_key_field(MEM_ROOT *root, Table *new_table, |
|
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
107 |
uchar *new_ptr, uchar *new_null_ptr, |
108 |
uint new_null_bit); |
|
109 |
uint is_equal(Create_field *new_field); |
|
290
by Brian Aker
Update for ulong change over. |
110 |
void hash(uint32_t *nr, uint32_t *nr2); |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
111 |
private: |
112 |
int do_save_field_metadata(uchar *first_byte); |
|
113 |
};
|
|
114 |
||
115 |
#endif
|
|
116 |