~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/str.h

  • Committer: Brian Aker
  • Date: 2010-08-18 20:55:22 UTC
  • mfrom: (1711.6.3 staging)
  • Revision ID: brian@tangent.org-20100818205522-esgel82hp9kyl3l2
Merge mutex patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#pragma once
 
21
#ifndef DRIZZLED_FIELD_STR_H
 
22
#define DRIZZLED_FIELD_STR_H
22
23
 
23
24
#include <drizzled/field.h>
24
25
 
25
 
#include <drizzled/visibility.h>
26
 
 
27
26
namespace drizzled
28
27
{
29
28
 
 
29
typedef struct charset_info_st CHARSET_INFO;
 
30
 
30
31
/* base class for all string related classes */
31
32
 
32
 
class DRIZZLED_API Field_str :
33
 
  public Field
34
 
{
 
33
class Field_str :public Field {
35
34
protected:
36
 
  const charset_info_st *field_charset;
 
35
  const CHARSET_INFO *field_charset;
37
36
  enum Derivation field_derivation;
38
37
  int  report_if_important_data(const char *ptr, const char *end);
39
38
public:
42
41
            unsigned char *null_ptr_arg,
43
42
            unsigned char null_bit_arg,
44
43
            const char *field_name_arg,
45
 
            const charset_info_st * const charset);
 
44
            const CHARSET_INFO * const charset);
46
45
  Item_result result_type () const { return STRING_RESULT; }
47
46
  uint32_t decimals() const { return NOT_FIXED_DEC; }
48
47
 
49
48
  using Field::store;
50
49
  int  store(double nr);
51
50
  int  store(int64_t nr, bool unsigned_val)=0;
52
 
  int  store_decimal(const type::Decimal *);
53
 
  int  store(const char *to,uint32_t length, const charset_info_st * const cs)=0;
 
51
  int  store_decimal(const my_decimal *);
 
52
  int  store(const char *to,uint32_t length, const CHARSET_INFO * const cs)=0;
54
53
 
55
54
  uint32_t size_of() const { return sizeof(*this); }
56
 
  const charset_info_st *charset(void) const { return field_charset; }
57
 
  void set_charset(const charset_info_st * const charset_arg)
 
55
  const CHARSET_INFO *charset(void) const { return field_charset; }
 
56
  void set_charset(const CHARSET_INFO * const charset_arg)
58
57
  { field_charset= charset_arg; }
59
58
  enum Derivation derivation(void) const { return field_derivation; }
60
59
  virtual void set_derivation(enum Derivation derivation_arg)
62
61
  bool binary() const { return field_charset == &my_charset_bin; }
63
62
  uint32_t max_display_length() { return field_length; }
64
63
  friend class CreateField;
65
 
  type::Decimal *val_decimal(type::Decimal *) const;
 
64
  my_decimal *val_decimal(my_decimal *);
66
65
  virtual bool str_needs_quotes() { return true; }
67
66
  uint32_t max_data_length() const;
68
67
};
97
96
                             const char *well_formed_error_pos,
98
97
                             const char *cannot_convert_error_pos,
99
98
                             const char *end,
100
 
                             const charset_info_st * const cs);
 
99
                             const CHARSET_INFO * const cs);
101
100
 
102
101
 
103
102
} /* namespace drizzled */
104
103
 
 
104
#endif /* DRIZZLED_FIELD_STR_H */