~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/long.h

  • Committer: Brian Aker
  • Date: 2008-10-06 06:47:29 UTC
  • Revision ID: brian@tangent.org-20081006064729-2i9mhjkzyvow9xsm
RemoveĀ uint.

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
 
 
26
24
class Field_long :public Field_num {
27
25
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
 
 
36
26
  Field_long(unsigned char *ptr_arg, uint32_t len_arg, unsigned char *null_ptr_arg,
37
27
             unsigned char null_bit_arg,
38
28
             enum utype unireg_check_arg, const char *field_name_arg,
56
46
  int reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; }
57
47
  double val_real(void);
58
48
  int64_t val_int(void);
 
49
  bool send_binary(Protocol *protocol);
59
50
  String *val_str(String*,String *);
60
51
  int cmp(const unsigned char *,const unsigned char *);
61
52
  void sort_string(unsigned char *buff,uint32_t length);
63
54
  void sql_type(String &str) const;
64
55
  uint32_t max_display_length() { return MY_INT32_NUM_DECIMAL_DIGITS; }
65
56
  virtual unsigned char *pack(unsigned char* to, const unsigned char *from,
66
 
                      uint32_t max_length,
67
 
                      bool low_byte_first);
 
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
  }
68
76
 
69
77
  virtual const unsigned char *unpack(unsigned char* to, const unsigned char *from,
70
 
                              uint32_t param_data,
71
 
                              bool low_byte_first);
 
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
  }
72
97
};
73
98
 
74
99
#endif