~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/field/string.h

  • Committer: Patrick Galbraith
  • Date: 2008-07-24 16:57:40 UTC
  • mto: (202.2.4 rename-mysql-to-drizzle)
  • mto: This revision was merged to the branch mainline in revision 212.
  • Revision ID: patg@ishvara-20080724165740-x58yw6zs6d9o17lf
Most everything working with client rename
mysqlslap test still fails... can't connect to the server

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
21
21
#ifndef DRIZZLE_SERVER_FIELD_STRING
22
22
#define DRIZZLE_SERVER_FIELD_STRING
23
23
 
 
24
#include "mysql_priv.h"
 
25
 
24
26
class Field_string :public Field_longstr {
25
27
public:
26
28
  bool can_alter_field_type;
27
 
  Field_string(unsigned char *ptr_arg, uint32_t len_arg,unsigned char *null_ptr_arg,
28
 
               unsigned char null_bit_arg,
 
29
  Field_string(uchar *ptr_arg, uint32_t len_arg,uchar *null_ptr_arg,
 
30
               uchar null_bit_arg,
29
31
               enum utype unireg_check_arg, const char *field_name_arg,
30
 
               const CHARSET_INFO * const cs)
 
32
               CHARSET_INFO *cs)
31
33
    :Field_longstr(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
32
34
                   unireg_check_arg, field_name_arg, cs),
33
35
     can_alter_field_type(1) {};
34
36
  Field_string(uint32_t len_arg,bool maybe_null_arg, const char *field_name_arg,
35
 
               const CHARSET_INFO * const cs)
36
 
    :Field_longstr((unsigned char*) 0, len_arg, maybe_null_arg ? (unsigned char*) "": 0, 0,
 
37
               CHARSET_INFO *cs)
 
38
    :Field_longstr((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, 0,
37
39
                   NONE, field_name_arg, cs),
38
40
     can_alter_field_type(1) {};
39
41
 
40
42
  enum_field_types type() const
41
43
  {
42
 
    return  DRIZZLE_TYPE_VARCHAR;
 
44
    return  MYSQL_TYPE_STRING;
43
45
  }
44
46
  enum ha_base_keytype key_type() const
45
47
    { return binary() ? HA_KEYTYPE_BINARY : HA_KEYTYPE_TEXT; }
50
52
                          (has_charset() ? ' ' : 0));
51
53
    return 0;
52
54
  }
53
 
  int store(const char *to,uint32_t length, const CHARSET_INFO * const charset);
 
55
  int store(const char *to,uint length,CHARSET_INFO *charset);
54
56
  int store(int64_t nr, bool unsigned_val);
55
57
  int store(double nr) { return Field_str::store(nr); } /* QQ: To be deleted */
56
58
  double val_real(void);
57
59
  int64_t val_int(void);
58
60
  String *val_str(String*,String *);
59
61
  my_decimal *val_decimal(my_decimal *);
60
 
  int cmp(const unsigned char *,const unsigned char *);
61
 
  void sort_string(unsigned char *buff,uint32_t length);
 
62
  int cmp(const uchar *,const uchar *);
 
63
  void sort_string(uchar *buff,uint length);
62
64
  void sql_type(String &str) const;
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)
 
65
  virtual uchar *pack(uchar *to, const uchar *from,
 
66
                      uint max_length, bool low_byte_first);
 
67
  virtual const uchar *unpack(uchar* to, const uchar *from,
 
68
                              uint param_data, bool low_byte_first);
 
69
  uint pack_length_from_metadata(uint field_metadata)
68
70
  { return (field_metadata & 0x00ff); }
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
 
               bool insert_or_update);
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
 
  enum_field_types real_type() const { return DRIZZLE_TYPE_VARCHAR; }
 
71
  uint row_pack_length() { return (field_length + 1); }
 
72
  int pack_cmp(const uchar *a,const uchar *b,uint key_length,
 
73
               my_bool insert_or_update);
 
74
  int pack_cmp(const uchar *b,uint key_length,my_bool insert_or_update);
 
75
  uint packed_col_length(const uchar *to, uint length);
 
76
  uint max_packed_col_length(uint max_length);
 
77
  uint size_of() const { return sizeof(*this); }
 
78
  enum_field_types real_type() const { return MYSQL_TYPE_STRING; }
77
79
  bool has_charset(void) const
78
80
  { return charset() == &my_charset_bin ? false : true; }
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
  Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type);
 
82
  virtual uint get_key_image(uchar *buff,uint length, imagetype type);
81
83
private:
82
 
  int do_save_field_metadata(unsigned char *first_byte);
 
84
  int do_save_field_metadata(uchar *first_byte);
83
85
};
84
86
 
85
 
#endif /* DRIZZLE_SERVER_FIELD_STRING */ 
 
87
#endif