466
by Monty Taylor
Fixed modelines... these files are c++. |
1 |
/* - mode: c++ c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
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 |
||
1122.2.10
by Monty Taylor
Fixed all of the include guards. |
21 |
#ifndef DRIZZLED_FIELD_VARSTRING_H
|
22 |
#define DRIZZLED_FIELD_VARSTRING_H
|
|
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
23 |
|
1034.1.3
by Brian Aker
Collapse field classes (this does change enum/time decimal conversion |
24 |
#include <drizzled/field/str.h> |
656.1.1
by Monty Taylor
OOOh doggie. Got rid of my_alloca. |
25 |
#include <string> |
584.5.1
by Monty Taylor
Removed field includes from field.h. |
26 |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
27 |
namespace drizzled |
28 |
{
|
|
29 |
||
1034.1.3
by Brian Aker
Collapse field classes (this does change enum/time decimal conversion |
30 |
class Field_varstring :public Field_str { |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
31 |
public: |
779.3.18
by Monty Taylor
Cleaned up warnings up through innodb. |
32 |
|
33 |
using Field::store; |
|
34 |
using Field::pack; |
|
35 |
using Field::unpack; |
|
36 |
using Field::val_int; |
|
37 |
using Field::val_str; |
|
38 |
||
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
39 |
/*
|
40 |
The maximum space available in a Field_varstring, in bytes. See
|
|
41 |
length_bytes.
|
|
42 |
*/
|
|
482
by Brian Aker
Remove uint. |
43 |
static const uint32_t MAX_SIZE; |
1782.4.5
by Brian Aker
Encapsulate the length of the bytes in the varchar header. |
44 |
private: |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
45 |
/* Store number of bytes used to store length (1 or 2) */
|
205
by Brian Aker
uint32 -> uin32_t |
46 |
uint32_t length_bytes; |
1782.4.5
by Brian Aker
Encapsulate the length of the bytes in the varchar header. |
47 |
public: |
481
by Brian Aker
Remove all of uchar. |
48 |
Field_varstring(unsigned char *ptr_arg, |
1119.9.12
by Jay Pipes
First phase removal of MTYP_TYPENR() macro. This removes the unireg_check argument for all Field types where it is irrelevant (everything but numeric types and timestamp. |
49 |
uint32_t len_arg, |
50 |
uint32_t length_bytes_arg, |
|
51 |
unsigned char *null_ptr_arg, |
|
52 |
unsigned char null_bit_arg, |
|
53 |
const char *field_name_arg, |
|
54 |
const CHARSET_INFO * const cs); |
|
55 |
Field_varstring(uint32_t len_arg, |
|
56 |
bool maybe_null_arg, |
|
57 |
const char *field_name_arg, |
|
58 |
const CHARSET_INFO * const cs); |
|
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
59 |
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
60 |
enum_field_types type() const { return DRIZZLE_TYPE_VARCHAR; } |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
61 |
enum ha_base_keytype key_type() const; |
62 |
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. |
63 |
int reset(void) { memset(ptr, 0, field_length+length_bytes); return 0; } |
205
by Brian Aker
uint32 -> uin32_t |
64 |
uint32_t pack_length() const { return (uint32_t) field_length+length_bytes; } |
1782.4.5
by Brian Aker
Encapsulate the length of the bytes in the varchar header. |
65 |
uint32_t pack_length_no_ptr() const { return length_bytes; } |
205
by Brian Aker
uint32 -> uin32_t |
66 |
uint32_t key_length() const { return (uint32_t) field_length; } |
67 |
uint32_t sort_length() const |
|
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
68 |
{
|
205
by Brian Aker
uint32 -> uin32_t |
69 |
return (uint32_t) field_length + (field_charset == &my_charset_bin ? |
1782.4.6
by Brian Aker
Style cleanup (no real changes). |
70 |
length_bytes : 0); |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
71 |
}
|
482
by Brian Aker
Remove uint. |
72 |
int store(const char *to,uint32_t length, const CHARSET_INFO * const charset); |
779.3.18
by Monty Taylor
Cleaned up warnings up through innodb. |
73 |
|
74 |
||
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
75 |
int store(int64_t nr, bool unsigned_val); |
76 |
int store(double nr) { return Field_str::store(nr); } /* QQ: To be deleted */ |
|
77 |
double val_real(void); |
|
78 |
int64_t val_int(void); |
|
79 |
String *val_str(String*,String *); |
|
779.3.16
by Monty Taylor
Some Sun warning fixes. |
80 |
inline String *val_str(String *str) { return val_str(str, str); } |
2030.1.4
by Brian Aker
Change my_decimal to Decimal |
81 |
type::Decimal *val_decimal(type::Decimal *); |
481
by Brian Aker
Remove all of uchar. |
82 |
int cmp_max(const unsigned char *, const unsigned char *, uint32_t max_length); |
779.3.16
by Monty Taylor
Some Sun warning fixes. |
83 |
inline int cmp(const unsigned char *str) { return cmp(ptr,str); } |
481
by Brian Aker
Remove all of uchar. |
84 |
int cmp(const unsigned char *a,const unsigned char *b) |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
85 |
{
|
365.2.6
by Monty Taylor
Undid some stupid int->int16_t conversions. |
86 |
return cmp_max(a, b, UINT32_MAX); |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
87 |
}
|
482
by Brian Aker
Remove uint. |
88 |
void sort_string(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... |
89 |
uint32_t get_key_image(unsigned char *buff,uint32_t length); |
90 |
uint32_t get_key_image(std::basic_string <unsigned char> &buff, uint32_t length); |
|
482
by Brian Aker
Remove uint. |
91 |
void set_key_image(const unsigned char *buff,uint32_t length); |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
92 |
void sql_type(String &str) const; |
1237.6.8
by Brian Aker
More dead varstring field code. |
93 |
virtual unsigned char *pack(unsigned char *to, |
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... |
94 |
const unsigned char *from, |
779.3.16
by Monty Taylor
Some Sun warning fixes. |
95 |
uint32_t max_length, |
96 |
bool low_byte_first); |
|
97 |
||
98 |
virtual const unsigned char *unpack(unsigned char* to, |
|
99 |
const unsigned char *from, |
|
100 |
uint32_t param_data, |
|
101 |
bool low_byte_first); |
|
1237.6.8
by Brian Aker
More dead varstring field code. |
102 |
|
481
by Brian Aker
Remove all of uchar. |
103 |
int cmp_binary(const unsigned char *a,const unsigned char *b, uint32_t max_length=UINT32_MAX); |
104 |
int key_cmp(const unsigned char *,const unsigned char*); |
|
482
by Brian Aker
Remove uint. |
105 |
int key_cmp(const unsigned char *str, uint32_t length); |
106 |
uint32_t max_packed_col_length(uint32_t max_length); |
|
205
by Brian Aker
uint32 -> uin32_t |
107 |
uint32_t used_length(); |
482
by Brian Aker
Remove uint. |
108 |
uint32_t size_of() const { return sizeof(*this); } |
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
109 |
enum_field_types real_type() const { return DRIZZLE_TYPE_VARCHAR; } |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
110 |
bool has_charset(void) const |
111 |
{ return charset() == &my_charset_bin ? false : true; } |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
112 |
Field *new_field(memory::Root *root, Table *new_table, bool keep_type); |
113 |
Field *new_key_field(memory::Root *root, Table *new_table, |
|
481
by Brian Aker
Remove all of uchar. |
114 |
unsigned char *new_ptr, unsigned char *new_null_ptr, |
482
by Brian Aker
Remove uint. |
115 |
uint32_t new_null_bit); |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
116 |
};
|
117 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
118 |
} /* namespace drizzled */ |
119 |
||
1122.2.10
by Monty Taylor
Fixed all of the include guards. |
120 |
#endif /* DRIZZLED_FIELD_VARSTRING_H */ |
173.1.7
by Toru Maesaka
ripped out TIME and VARSTRING, moved to field/ |
121 |