~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/fstring.h

  • Committer: Mark Atwood
  • Date: 2008-10-16 11:33:16 UTC
  • mto: (520.1.13 drizzle)
  • mto: This revision was merged to the branch mainline in revision 530.
  • Revision ID: mark@fallenpegasus.com-20081016113316-ff6jdt31ck90sjdh
an implemention of the errmsg plugin

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
1
/* - mode: c++ c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
4
 *  Copyright (C) 2008 MySQL
24
24
class Field_string :public Field_longstr {
25
25
public:
26
26
  bool can_alter_field_type;
27
 
  Field_string(uchar *ptr_arg, uint32_t len_arg,uchar *null_ptr_arg,
28
 
               uchar null_bit_arg,
 
27
  Field_string(unsigned char *ptr_arg, uint32_t len_arg,unsigned char *null_ptr_arg,
 
28
               unsigned char null_bit_arg,
29
29
               enum utype unireg_check_arg, const char *field_name_arg,
30
30
               const CHARSET_INFO * const cs)
31
31
    :Field_longstr(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
33
33
     can_alter_field_type(1) {};
34
34
  Field_string(uint32_t len_arg,bool maybe_null_arg, const char *field_name_arg,
35
35
               const CHARSET_INFO * const cs)
36
 
    :Field_longstr((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, 0,
 
36
    :Field_longstr((unsigned char*) 0, len_arg, maybe_null_arg ? (unsigned char*) "": 0, 0,
37
37
                   NONE, field_name_arg, cs),
38
38
     can_alter_field_type(1) {};
39
39
 
50
50
                          (has_charset() ? ' ' : 0));
51
51
    return 0;
52
52
  }
53
 
  int store(const char *to,uint length, const CHARSET_INFO * const charset);
 
53
  int store(const char *to,uint32_t length, const CHARSET_INFO * const charset);
54
54
  int store(int64_t nr, bool unsigned_val);
55
55
  int store(double nr) { return Field_str::store(nr); } /* QQ: To be deleted */
56
56
  double val_real(void);
57
57
  int64_t val_int(void);
58
58
  String *val_str(String*,String *);
59
59
  my_decimal *val_decimal(my_decimal *);
60
 
  int cmp(const uchar *,const uchar *);
61
 
  void sort_string(uchar *buff,uint length);
 
60
  int cmp(const unsigned char *,const unsigned char *);
 
61
  void sort_string(unsigned char *buff,uint32_t length);
62
62
  void sql_type(String &str) const;
63
 
  virtual uchar *pack(uchar *to, const uchar *from,
64
 
                      uint max_length, bool low_byte_first);
65
 
  virtual const uchar *unpack(uchar* to, const uchar *from,
66
 
                              uint param_data, bool low_byte_first);
67
 
  uint pack_length_from_metadata(uint field_metadata)
 
63
  virtual unsigned char *pack(unsigned char *to, const unsigned char *from,
 
64
                      uint32_t max_length, bool low_byte_first);
 
65
  virtual const unsigned char *unpack(unsigned char* to, const unsigned char *from,
 
66
                              uint32_t param_data, bool low_byte_first);
 
67
  uint32_t pack_length_from_metadata(uint32_t field_metadata)
68
68
  { return (field_metadata & 0x00ff); }
69
 
  uint row_pack_length() { return (field_length + 1); }
70
 
  int pack_cmp(const uchar *a,const uchar *b,uint key_length,
 
69
  uint32_t row_pack_length() { return (field_length + 1); }
 
70
  int pack_cmp(const unsigned char *a,const unsigned char *b,uint32_t key_length,
71
71
               bool insert_or_update);
72
 
  int pack_cmp(const uchar *b,uint key_length,bool insert_or_update);
73
 
  uint packed_col_length(const uchar *to, uint length);
74
 
  uint max_packed_col_length(uint max_length);
75
 
  uint size_of() const { return sizeof(*this); }
 
72
  int pack_cmp(const unsigned char *b,uint32_t key_length,bool insert_or_update);
 
73
  uint32_t packed_col_length(const unsigned char *to, uint32_t length);
 
74
  uint32_t max_packed_col_length(uint32_t max_length);
 
75
  uint32_t size_of() const { return sizeof(*this); }
76
76
  enum_field_types real_type() const { return DRIZZLE_TYPE_VARCHAR; }
77
77
  bool has_charset(void) const
78
78
  { return charset() == &my_charset_bin ? false : true; }
79
 
  Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type);
80
 
  virtual uint get_key_image(uchar *buff,uint length, imagetype type);
 
79
  Field *new_field(MEM_ROOT *root, Table *new_table, bool keep_type);
 
80
  virtual uint32_t get_key_image(unsigned char *buff,uint32_t length, imagetype type);
81
81
private:
82
 
  int do_save_field_metadata(uchar *first_byte);
 
82
  int do_save_field_metadata(unsigned char *first_byte);
83
83
};
84
84
 
85
85
#endif /* DRIZZLE_SERVER_FIELD_STRING */