Drizzled Public API Documentation

size.h
00001 /* - mode: c++ c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2008 MySQL
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
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; } // +1 for sign
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 } /* namespace field */
00082 } /* namespace drizzled */
00083