Drizzled Public API Documentation

double.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/real.h>
00024 
00025 namespace drizzled
00026 {
00027 
00028 class Field_double :public Field_real {
00029 public:
00030 
00031   using Field::store;
00032   using Field::val_int;
00033   using Field::val_str;
00034   using Field::cmp;
00035 
00036   Field_double(unsigned char *ptr_arg, uint32_t len_arg,
00037                unsigned char *null_ptr_arg,
00038                unsigned char null_bit_arg,
00039                enum utype unireg_check_arg, const char *field_name_arg,
00040                uint8_t dec_arg,bool zero_arg,bool unsigned_arg)
00041     :Field_real(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
00042                 unireg_check_arg, field_name_arg,
00043                 dec_arg, zero_arg, unsigned_arg)
00044     {}
00045   Field_double(uint32_t len_arg, bool maybe_null_arg, const char *field_name_arg,
00046          uint8_t dec_arg)
00047     :Field_real((unsigned char*) 0, len_arg, maybe_null_arg ? (unsigned char*) "" : 0, (uint32_t) 0,
00048                 NONE, field_name_arg, dec_arg, 0, 0)
00049     {}
00050   Field_double(uint32_t len_arg, bool maybe_null_arg, const char *field_name_arg,
00051          uint8_t dec_arg, bool not_fixed_arg)
00052     :Field_real((unsigned char*) 0, len_arg, maybe_null_arg ? (unsigned char*) "" : 0, (uint32_t) 0,
00053                 NONE, field_name_arg, dec_arg, 0, 0)
00054     {not_fixed= not_fixed_arg; }
00055   enum_field_types type() const { return DRIZZLE_TYPE_DOUBLE;}
00056   enum ha_base_keytype key_type() const { return HA_KEYTYPE_DOUBLE; }
00057   int  store(const char *to,uint32_t length, const CHARSET_INFO * const charset);
00058   int  store(double nr);
00059   int  store(int64_t nr, bool unsigned_val);
00060   int reset(void) { memset(ptr, 0, sizeof(double)); return 0; }
00061   double val_real(void) const;
00062   int64_t val_int(void) const;
00063   String *val_str(String*,String *) const;
00064   int cmp(const unsigned char *,const unsigned char *);
00065   void sort_string(unsigned char *buff,uint32_t length);
00066   uint32_t pack_length() const { return sizeof(double); }
00067   void sql_type(String &str) const;
00068 };
00069 
00070 } /* namespace drizzled */
00071 
00072