~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/varstring.h

  • Committer: Jay Pipes
  • Date: 2009-11-16 22:00:02 UTC
  • mto: (1234.1.1 push) (1237.2.10 push)
  • mto: This revision was merged to the branch mainline in revision 1229.
  • Revision ID: jpipes@serialcoder-20091116220002-rdsha64utt41i8w8
Adds INFORMATION_SCHEMA views for the transaction log:

TRANSACTION_LOG
TRANSACTION_LOG_ENTRIES
TRANSACTION_LOG_TRANSACTIONS

Adds a new user-defined function:

PRINT_TRANSACTION_MESSAGE(filename, offset)

Adds tests for all of the above

Implementation notes:

An indexer now runs when transaction messages are applied
to the transaction log.  It creates a simple index of the
transaction log entries.  This index is used when the
information schema views' fillTable() method is called.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <drizzled/field/str.h>
25
25
#include <string>
26
26
 
27
 
namespace drizzled
28
 
{
29
 
 
30
27
class Field_varstring :public Field_str {
31
28
public:
32
29
 
41
38
    length_bytes.
42
39
  */
43
40
  static const uint32_t MAX_SIZE;
44
 
private:
45
41
  /* Store number of bytes used to store length (1 or 2) */
46
42
  uint32_t length_bytes;
47
 
public:
48
43
  Field_varstring(unsigned char *ptr_arg,
49
44
                  uint32_t len_arg,
50
45
                  uint32_t length_bytes_arg,
51
46
                  unsigned char *null_ptr_arg,
52
47
                  unsigned char null_bit_arg,
53
48
                  const char *field_name_arg,
 
49
                  TableShare *share,
54
50
                  const CHARSET_INFO * const cs);
55
51
  Field_varstring(uint32_t len_arg,
56
52
                  bool maybe_null_arg,
57
53
                  const char *field_name_arg,
 
54
                  TableShare *share,
58
55
                  const CHARSET_INFO * const cs);
59
56
 
60
57
  enum_field_types type() const { return DRIZZLE_TYPE_VARCHAR; }
61
58
  enum ha_base_keytype key_type() const;
 
59
  uint32_t row_pack_length() { return field_length; }
62
60
  bool zero_pack() const { return 0; }
63
61
  int  reset(void) { memset(ptr, 0, field_length+length_bytes); return 0; }
64
62
  uint32_t pack_length() const { return (uint32_t) field_length+length_bytes; }
65
 
  uint32_t pack_length_no_ptr() const { return length_bytes; }
66
63
  uint32_t key_length() const { return (uint32_t) field_length; }
67
64
  uint32_t sort_length() const
68
65
  {
69
66
    return (uint32_t) field_length + (field_charset == &my_charset_bin ?
70
 
                                      length_bytes : 0);
 
67
                                    length_bytes : 0);
71
68
  }
72
69
  int  store(const char *to,uint32_t length, const CHARSET_INFO * const charset);
73
70
 
90
87
  uint32_t get_key_image(std::basic_string <unsigned char> &buff, uint32_t length);
91
88
  void set_key_image(const unsigned char *buff,uint32_t length);
92
89
  void sql_type(String &str) const;
93
 
  virtual unsigned char *pack(unsigned char *to,
 
90
  virtual unsigned char *pack(unsigned char *to, 
94
91
                              const unsigned char *from,
95
92
                              uint32_t max_length,
96
93
                              bool low_byte_first);
97
94
 
 
95
  unsigned char *pack_key(unsigned char *to, const unsigned char *from, uint32_t max_length, bool low_byte_first);
 
96
  unsigned char *pack_key_from_key_image(unsigned char* to,
 
97
                                         const unsigned char *from,
 
98
                                         uint32_t max_length,
 
99
                                         bool low_byte_first);
98
100
  virtual const unsigned char *unpack(unsigned char* to,
99
101
                                      const unsigned char *from,
100
102
                                      uint32_t param_data,
101
103
                                      bool low_byte_first);
102
 
 
 
104
 
 
105
  const unsigned char *unpack_key(unsigned char* to, const unsigned char *from,
 
106
                          uint32_t max_length, bool low_byte_first);
 
107
  int pack_cmp(const unsigned char *a, const unsigned char *b, uint32_t key_length,
 
108
               bool insert_or_update);
 
109
  int pack_cmp(const unsigned char *b, uint32_t key_length,bool insert_or_update);
103
110
  int cmp_binary(const unsigned char *a,const unsigned char *b, uint32_t max_length=UINT32_MAX);
104
111
  int key_cmp(const unsigned char *,const unsigned char*);
105
112
  int key_cmp(const unsigned char *str, uint32_t length);
 
113
  uint32_t packed_col_length(const unsigned char *to, uint32_t length);
106
114
  uint32_t max_packed_col_length(uint32_t max_length);
 
115
  uint32_t data_length();
107
116
  uint32_t used_length();
108
117
  uint32_t size_of() const { return sizeof(*this); }
109
118
  enum_field_types real_type() const { return DRIZZLE_TYPE_VARCHAR; }
110
119
  bool has_charset(void) const
111
120
  { return charset() == &my_charset_bin ? false : true; }
112
 
  Field *new_field(memory::Root *root, Table *new_table, bool keep_type);
113
 
  Field *new_key_field(memory::Root *root, Table *new_table,
 
121
  Field *new_field(MEM_ROOT *root, Table *new_table, bool keep_type);
 
122
  Field *new_key_field(MEM_ROOT *root, Table *new_table,
114
123
                       unsigned char *new_ptr, unsigned char *new_null_ptr,
115
124
                       uint32_t new_null_bit);
 
125
  uint32_t is_equal(CreateField *new_field);
 
126
  void hash(uint32_t *nr, uint32_t *nr2);
 
127
private:
 
128
  int do_save_field_metadata(unsigned char *first_byte);
116
129
};
117
130
 
118
 
} /* namespace drizzled */
119
 
 
120
131
#endif /* DRIZZLED_FIELD_VARSTRING_H */
121
132