Drizzled Public API Documentation

num.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.h>
00024 
00025 namespace drizzled
00026 {
00027 
00028 class Field_num :public Field 
00029 {
00030 public:
00031   const uint8_t dec;
00032   bool decimal_precision;       // Purify cannot handle bit fields & only for decimal type
00033   bool unsigned_flag;   // Purify cannot handle bit fields
00034 
00035   Field_num(unsigned char *ptr_arg,uint32_t len_arg, unsigned char *null_ptr_arg,
00036             unsigned char null_bit_arg, utype unireg_check_arg,
00037             const char *field_name_arg,
00038             uint8_t dec_arg, bool zero_arg, bool unsigned_arg);
00039 
00040   Item_result result_type () const { return REAL_RESULT; }
00041 
00042   friend class CreateField;
00043 
00044   void make_field(SendField *);
00045 
00046   uint32_t decimals() const { return (uint32_t) dec; }
00047 
00048   uint32_t size_of() const { return sizeof(*this); }
00049 
00050   bool eq_def(Field *field);
00051 
00052   int store_decimal(const type::Decimal *);
00053 
00054   type::Decimal *val_decimal(type::Decimal *) const;
00055 
00056   uint32_t is_equal(CreateField *new_field);
00057 
00058   int check_int(const CHARSET_INFO * const cs, const char *str, int length,
00059                 const char *int_end, int error);
00060 
00061   bool get_int(const CHARSET_INFO * const cs, const char *from, uint32_t len,
00062                int64_t *rnd, uint64_t unsigned_max,
00063                int64_t signed_min, int64_t signed_max);
00064 };
00065 
00066 } /* namespace drizzled */
00067