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
00031
00032 class DRIZZLED_API Field_str :
00033 public Field
00034 {
00035 protected:
00036 const charset_info_st *field_charset;
00037 enum Derivation field_derivation;
00038 int report_if_important_data(const char *ptr, const char *end);
00039 public:
00040 Field_str(unsigned char *ptr_arg,
00041 uint32_t len_arg,
00042 unsigned char *null_ptr_arg,
00043 unsigned char null_bit_arg,
00044 const char *field_name_arg,
00045 const charset_info_st * const charset);
00046 Item_result result_type () const { return STRING_RESULT; }
00047 uint32_t decimals() const { return NOT_FIXED_DEC; }
00048
00049 using Field::store;
00050 int store(double nr);
00051 int store(int64_t nr, bool unsigned_val)=0;
00052 int store_decimal(const type::Decimal *);
00053 int store(const char *to,uint32_t length, const charset_info_st * const cs)=0;
00054
00055 uint32_t size_of() const { return sizeof(*this); }
00056 const charset_info_st *charset(void) const { return field_charset; }
00057 void set_charset(const charset_info_st * const charset_arg)
00058 { field_charset= charset_arg; }
00059 enum Derivation derivation(void) const { return field_derivation; }
00060 virtual void set_derivation(enum Derivation derivation_arg)
00061 { field_derivation= derivation_arg; }
00062 bool binary() const { return field_charset == &my_charset_bin; }
00063 uint32_t max_display_length() { return field_length; }
00064 friend class CreateField;
00065 type::Decimal *val_decimal(type::Decimal *) const;
00066 virtual bool str_needs_quotes() { return true; }
00067 uint32_t max_data_length() const;
00068 };
00069
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 bool check_string_copy_error(Field_str *field,
00097 const char *well_formed_error_pos,
00098 const char *cannot_convert_error_pos,
00099 const char *end,
00100 const charset_info_st * const cs);
00101
00102
00103 }
00104