~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/blob.h

  • Committer: Andrew Hutchings
  • Date: 2011-02-01 10:23:22 UTC
  • mto: (2136.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 2137.
  • Revision ID: andrew@linuxjedi.co.uk-20110201102322-oxztcyrjzg3c7yta
Fix counters cleanup

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_BLOB_H
 
22
#define DRIZZLED_FIELD_BLOB_H
22
23
 
23
24
#include <drizzled/field/str.h>
24
 
#include <drizzled/charset.h>
 
25
 
 
26
#include "drizzled/global_charset_info.h"
 
27
 
25
28
#include <string>
26
 
#include <drizzled/visibility.h>
27
 
 
28
 
namespace drizzled {
 
29
 
 
30
#include "drizzled/visibility.h"
 
31
 
 
32
namespace drizzled
 
33
{
29
34
 
30
35
/**
31
36
 * Class representing a BLOB data type column
49
54
             unsigned char null_bit_arg,
50
55
             const char *field_name_arg,
51
56
             TableShare *share,
52
 
             const charset_info_st * const cs);
 
57
             const CHARSET_INFO * const cs);
53
58
  Field_blob(uint32_t len_arg,
54
59
             bool maybe_null_arg,
55
60
             const char *field_name_arg,
56
 
             const charset_info_st * const cs)
 
61
             const CHARSET_INFO * const cs)
57
62
    :Field_str((unsigned char*) NULL,
58
63
               len_arg,
59
64
               maybe_null_arg ? (unsigned char *) "": 0,
68
73
  enum ha_base_keytype key_type() const
69
74
    { return binary() ? HA_KEYTYPE_VARBINARY2 : HA_KEYTYPE_VARTEXT2; }
70
75
  int  store(const char *to,uint32_t length,
71
 
             const charset_info_st * const charset);
 
76
             const CHARSET_INFO * const charset);
72
77
  int  store(double nr);
73
78
  int  store(int64_t nr, bool unsigned_val);
74
79
 
75
 
  double val_real(void) const;
76
 
  int64_t val_int(void) const;
77
 
  String *val_str(String*,String *) const;
78
 
  type::Decimal *val_decimal(type::Decimal *) const;
 
80
  double val_real(void);
 
81
  int64_t val_int(void);
 
82
  String *val_str(String*,String *);
 
83
  type::Decimal *val_decimal(type::Decimal *);
79
84
  int cmp_max(const unsigned char *, const unsigned char *, uint32_t max_length);
80
85
  int cmp(const unsigned char *a,const unsigned char *b)
81
86
    { return cmp_max(a, b, UINT32_MAX); }
127
132
  */
128
133
  uint32_t get_packed_size(const unsigned char *ptr_arg, bool low_byte_first);
129
134
 
130
 
  DRIZZLED_API uint32_t get_length(uint32_t row_offset= 0) const;
131
 
  DRIZZLED_API uint32_t get_length(const unsigned char *ptr, bool low_byte_first) const;
132
 
  DRIZZLED_API uint32_t get_length(const unsigned char *ptr_arg) const;
 
135
  DRIZZLED_API uint32_t get_length(uint32_t row_offset= 0);
 
136
  DRIZZLED_API uint32_t get_length(const unsigned char *ptr, bool low_byte_first);
 
137
  DRIZZLED_API uint32_t get_length(const unsigned char *ptr_arg);
133
138
  void put_length(unsigned char *pos, uint32_t length);
134
139
  inline void get_ptr(unsigned char **str)
135
140
    {
162
167
  {
163
168
    unsigned char *tmp;
164
169
    get_ptr(&tmp);
165
 
    value.copy((char*) tmp, get_length(), charset());
 
170
    if (value.copy((char*) tmp, get_length(), charset()))
 
171
    {
 
172
      Field_blob::reset();
 
173
      return 1;
 
174
    }
166
175
    tmp=(unsigned char*) value.ptr();
167
176
    memcpy(ptr+sizeof(uint32_t),&tmp,sizeof(char*));
168
 
    return 0; // return void
 
177
    return 0;
169
178
  }
170
179
  virtual unsigned char *pack(unsigned char *to, const unsigned char *from,
171
180
                      uint32_t max_length, bool low_byte_first);
184
193
 
185
194
} /* namespace drizzled */
186
195
 
 
196
#endif /* DRIZZLED_FIELD_BLOB_H */
187
197