00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #pragma once
00022
00023 #include <drizzled/field.h>
00024
00025 #include <drizzled/visibility.h>
00026
00027 namespace drizzled
00028 {
00029
00030 typedef struct charset_info_st CHARSET_INFO;
00031
00032
00033
00034 class DRIZZLED_API Field_str :
00035 public Field
00036 {
00037 protected:
00038 const CHARSET_INFO *field_charset;
00039 enum Derivation field_derivation;
00040 int report_if_important_data(const char *ptr, const char *end);
00041 public:
00042 Field_str(unsigned char *ptr_arg,
00043 uint32_t len_arg,
00044 unsigned char *null_ptr_arg,
00045 unsigned char null_bit_arg,
00046 const char *field_name_arg,
00047 const CHARSET_INFO * const charset);
00048 Item_result result_type () const { return STRING_RESULT; }
00049 uint32_t decimals() const { return NOT_FIXED_DEC; }
00050
00051 using Field::store;
00052 int store(double nr);
00053 int store(int64_t nr, bool unsigned_val)=0;
00054 int store_decimal(const type::Decimal *);
00055 int store(const char *to,uint32_t length, const CHARSET_INFO * const cs)=0;
00056
00057 uint32_t size_of() const { return sizeof(*this); }
00058 const CHARSET_INFO *charset(void) const { return field_charset; }
00059 void set_charset(const CHARSET_INFO * const charset_arg)
00060 { field_charset= charset_arg; }
00061 enum Derivation derivation(void) const { return field_derivation; }
00062 virtual void set_derivation(enum Derivation derivation_arg)
00063 { field_derivation= derivation_arg; }
00064 bool binary() const { return field_charset == &my_charset_bin; }
00065 uint32_t max_display_length() { return field_length; }
00066 friend class CreateField;
00067 type::Decimal *val_decimal(type::Decimal *) const;
00068 virtual bool str_needs_quotes() { return true; }
00069 uint32_t max_data_length() const;
00070 };
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 bool check_string_copy_error(Field_str *field,
00099 const char *well_formed_error_pos,
00100 const char *cannot_convert_error_pos,
00101 const char *end,
00102 const CHARSET_INFO * const cs);
00103
00104
00105 }
00106