~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/long.h

Merged in latest plugin-slot-reorg.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#ifndef DRIZZLE_SERVER_FIELD_LONG
22
22
#define DRIZZLE_SERVER_FIELD_LONG
23
23
 
 
24
#include <drizzled/field/num.h>
 
25
 
24
26
class Field_long :public Field_num {
25
27
public:
 
28
 
 
29
  using Field::val_int;
 
30
  using Field::val_str;
 
31
  using Field::cmp;
 
32
  using Field::pack;
 
33
  using Field::store;
 
34
  using Field::unpack;
 
35
 
26
36
  Field_long(unsigned char *ptr_arg, uint32_t len_arg, unsigned char *null_ptr_arg,
27
37
             unsigned char null_bit_arg,
28
38
             enum utype unireg_check_arg, const char *field_name_arg,
46
56
  int reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; }
47
57
  double val_real(void);
48
58
  int64_t val_int(void);
49
 
  bool send_binary(Protocol *protocol);
50
59
  String *val_str(String*,String *);
51
60
  int cmp(const unsigned char *,const unsigned char *);
52
61
  void sort_string(unsigned char *buff,uint32_t length);
54
63
  void sql_type(String &str) const;
55
64
  uint32_t max_display_length() { return MY_INT32_NUM_DECIMAL_DIGITS; }
56
65
  virtual unsigned char *pack(unsigned char* to, const unsigned char *from,
57
 
                      uint32_t max_length __attribute__((unused)),
58
 
                      bool low_byte_first __attribute__((unused)))
59
 
  {
60
 
    int32_t val;
61
 
#ifdef WORDS_BIGENDIAN
62
 
    if (table->s->db_low_byte_first)
63
 
      val = sint4korr(from);
64
 
    else
65
 
#endif
66
 
      longget(val, from);
67
 
 
68
 
#ifdef WORDS_BIGENDIAN
69
 
    if (low_byte_first)
70
 
      int4store(to, val);
71
 
    else
72
 
#endif
73
 
      longstore(to, val);
74
 
    return to + sizeof(val);
75
 
  }
 
66
                      uint32_t max_length,
 
67
                      bool low_byte_first);
76
68
 
77
69
  virtual const unsigned char *unpack(unsigned char* to, const unsigned char *from,
78
 
                              uint32_t param_data __attribute__((unused)),
79
 
                              bool low_byte_first __attribute__((unused)))
80
 
  {
81
 
    int32_t val;
82
 
#ifdef WORDS_BIGENDIAN
83
 
    if (low_byte_first)
84
 
      val = sint4korr(from);
85
 
    else
86
 
#endif
87
 
      longget(val, from);
88
 
 
89
 
#ifdef WORDS_BIGENDIAN
90
 
    if (table->s->db_low_byte_first)
91
 
      int4store(to, val);
92
 
    else
93
 
#endif
94
 
      longstore(to, val);
95
 
    return from + sizeof(val);
96
 
  }
 
70
                              uint32_t param_data,
 
71
                              bool low_byte_first);
97
72
};
98
73
 
99
74
#endif