00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #pragma once
00022
00023 #include <drizzled/field/num.h>
00024
00025 namespace drizzled
00026 {
00027 namespace field
00028 {
00029
00030 class Size :public Field_num {
00031 public:
00032
00033 using Field::val_int;
00034 using Field::val_str;
00035 using Field::cmp;
00036 using Field::store;
00037 using Field::pack;
00038 using Field::unpack;
00039
00040 Size(unsigned char *ptr_arg, uint32_t len_arg,
00041 unsigned char *null_ptr_arg,
00042 unsigned char null_bit_arg,
00043 enum utype unireg_check_arg,
00044 const char *field_name_arg);
00045
00046 Size(uint32_t len_arg,bool maybe_null_arg,
00047 const char *field_name_arg,
00048 bool unsigned_arg);
00049
00050 enum Item_result result_type () const { return INT_RESULT; }
00051 enum_field_types type() const { return DRIZZLE_TYPE_LONGLONG;}
00052 enum ha_base_keytype key_type() const
00053 { return unsigned_flag ? HA_KEYTYPE_ULONGLONG : HA_KEYTYPE_LONGLONG; }
00054 int store(const char *to,uint32_t length, const CHARSET_INFO * const charset);
00055 int store(double nr);
00056 int store(int64_t nr, bool unsigned_val);
00057 int reset(void)
00058 {
00059 ptr[0]=ptr[1]=ptr[2]=ptr[3]=ptr[4]=ptr[5]=ptr[6]=ptr[7]=0;
00060 return 0;
00061 }
00062 double val_real(void) const;
00063 int64_t val_int(void) const;
00064 String *val_str(String*,String *) const;
00065 int cmp(const unsigned char *,const unsigned char *);
00066 void sort_string(unsigned char *buff,uint32_t length);
00067 uint32_t pack_length() const { return 8; }
00068 void sql_type(String &str) const;
00069 bool can_be_compared_as_int64_t() const { return true; }
00070 uint32_t max_display_length() { return MY_INT64_NUM_DECIMAL_DIGITS+1; }
00071 virtual unsigned char *pack(unsigned char* to, const unsigned char *from,
00072 uint32_t max_length,
00073 bool low_byte_first);
00074
00075 virtual const unsigned char *unpack(unsigned char* to, const unsigned char *from,
00076 uint32_t param_data,
00077 bool low_byte_first);
00078
00079 };
00080
00081 }
00082 }
00083