1
/* - mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 MySQL
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.
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.
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
21
#ifndef DRIZZLE_SERVER_FIELD_STR
22
#define DRIZZLE_SERVER_FIELD_STR
24
/* base class for all string related classes */
26
class Field_str :public Field {
28
const CHARSET_INFO *field_charset;
29
enum Derivation field_derivation;
31
Field_str(unsigned char *ptr_arg,uint32_t len_arg, unsigned char *null_ptr_arg,
32
unsigned char null_bit_arg, utype unireg_check_arg,
33
const char *field_name_arg, const CHARSET_INFO * const charset);
34
Item_result result_type () const { return STRING_RESULT; }
35
uint32_t decimals() const { return NOT_FIXED_DEC; }
37
int store(int64_t nr, bool unsigned_val)=0;
38
int store_decimal(const my_decimal *);
39
int store(const char *to,uint32_t length, const CHARSET_INFO * const cs)=0;
40
uint32_t size_of() const { return sizeof(*this); }
41
const CHARSET_INFO *charset(void) const { return field_charset; }
42
void set_charset(const CHARSET_INFO * const charset_arg) { field_charset= charset_arg; }
43
enum Derivation derivation(void) const { return field_derivation; }
44
virtual void set_derivation(enum Derivation derivation_arg)
45
{ field_derivation= derivation_arg; }
46
bool binary() const { return field_charset == &my_charset_bin; }
47
uint32_t max_display_length() { return field_length; }
48
friend class Create_field;
49
my_decimal *val_decimal(my_decimal *);
50
virtual bool str_needs_quotes() { return true; }
51
bool compare_str_field_flags(Create_field *new_field, uint32_t flags);
52
uint32_t is_equal(Create_field *new_field);