~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/field.h

  • Committer: Toru Maesaka
  • Date: 2008-07-18 06:16:06 UTC
  • mto: (202.1.1 toru)
  • mto: This revision was merged to the branch mainline in revision 204.
  • Revision ID: dev@torum.net-20080718061606-gwbuhgm12lr0k4yx
ripped out NEW_DATE and NEW_DECIMAL and moved to field/

Show diffs side-by-side

added added

removed removed

Lines of Context:
639
639
};
640
640
 
641
641
 
642
 
/* New decimal/numeric field which use fixed point arithmetic */
643
 
class Field_new_decimal :public Field_num {
644
 
private:
645
 
  int do_save_field_metadata(uchar *first_byte);
646
 
public:
647
 
  /* The maximum number of decimal digits can be stored */
648
 
  uint precision;
649
 
  uint bin_size;
650
 
  /*
651
 
    Constructors take max_length of the field as a parameter - not the
652
 
    precision as the number of decimal digits allowed.
653
 
    So for example we need to count length from precision handling
654
 
    CREATE TABLE ( DECIMAL(x,y)) 
655
 
  */
656
 
  Field_new_decimal(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
657
 
                    uchar null_bit_arg,
658
 
                    enum utype unireg_check_arg, const char *field_name_arg,
659
 
                    uint8 dec_arg, bool zero_arg, bool unsigned_arg);
660
 
  Field_new_decimal(uint32 len_arg, bool maybe_null_arg,
661
 
                    const char *field_name_arg, uint8 dec_arg,
662
 
                    bool unsigned_arg);
663
 
  enum_field_types type() const { return MYSQL_TYPE_NEWDECIMAL;}
664
 
  enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
665
 
  Item_result result_type () const { return DECIMAL_RESULT; }
666
 
  int  reset(void);
667
 
  bool store_value(const my_decimal *decimal_value);
668
 
  void set_value_on_overflow(my_decimal *decimal_value, bool sign);
669
 
  int  store(const char *to, uint length, CHARSET_INFO *charset);
670
 
  int  store(double nr);
671
 
  int  store(int64_t nr, bool unsigned_val);
672
 
  int store_time(MYSQL_TIME *ltime, timestamp_type t_type);
673
 
  int  store_decimal(const my_decimal *);
674
 
  double val_real(void);
675
 
  int64_t val_int(void);
676
 
  my_decimal *val_decimal(my_decimal *);
677
 
  String *val_str(String*, String *);
678
 
  int cmp(const uchar *, const uchar *);
679
 
  void sort_string(uchar *buff, uint length);
680
 
  bool zero_pack() const { return 0; }
681
 
  void sql_type(String &str) const;
682
 
  uint32 max_display_length() { return field_length; }
683
 
  uint size_of() const { return sizeof(*this); } 
684
 
  uint32 pack_length() const { return (uint32) bin_size; }
685
 
  uint pack_length_from_metadata(uint field_metadata);
686
 
  uint row_pack_length() { return pack_length(); }
687
 
  int compatible_field_size(uint field_metadata);
688
 
  uint is_equal(Create_field *new_field);
689
 
  virtual const uchar *unpack(uchar* to, const uchar *from,
690
 
                              uint param_data, bool low_byte_first);
691
 
};
692
 
 
693
 
 
694
642
class Field_tiny :public Field_num {
695
643
public:
696
644
  Field_tiny(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
1074
1022
};
1075
1023
 
1076
1024
 
1077
 
class Field_newdate :public Field_str {
1078
 
public:
1079
 
  Field_newdate(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
1080
 
                enum utype unireg_check_arg, const char *field_name_arg,
1081
 
                CHARSET_INFO *cs)
1082
 
    :Field_str(ptr_arg, 10, null_ptr_arg, null_bit_arg,
1083
 
               unireg_check_arg, field_name_arg, cs)
1084
 
    {}
1085
 
  Field_newdate(bool maybe_null_arg, const char *field_name_arg,
1086
 
                CHARSET_INFO *cs)
1087
 
    :Field_str((uchar*) 0,10, maybe_null_arg ? (uchar*) "": 0,0,
1088
 
               NONE, field_name_arg, cs) {}
1089
 
  enum_field_types type() const { return MYSQL_TYPE_NEWDATE;}
1090
 
  enum_field_types real_type() const { return MYSQL_TYPE_NEWDATE; }
1091
 
  enum ha_base_keytype key_type() const { return HA_KEYTYPE_UINT24; }
1092
 
  enum Item_result cmp_type () const { return INT_RESULT; }
1093
 
  int  store(const char *to,uint length,CHARSET_INFO *charset);
1094
 
  int  store(double nr);
1095
 
  int  store(int64_t nr, bool unsigned_val);
1096
 
  int store_time(MYSQL_TIME *ltime, timestamp_type type);
1097
 
  int reset(void) { ptr[0]=ptr[1]=ptr[2]=0; return 0; }
1098
 
  double val_real(void);
1099
 
  int64_t val_int(void);
1100
 
  String *val_str(String*,String *);
1101
 
  bool send_binary(Protocol *protocol);
1102
 
  int cmp(const uchar *,const uchar *);
1103
 
  void sort_string(uchar *buff,uint length);
1104
 
  uint32 pack_length() const { return 3; }
1105
 
  void sql_type(String &str) const;
1106
 
  bool can_be_compared_as_int64_t() const { return true; }
1107
 
  bool zero_pack() const { return 1; }
1108
 
  bool get_date(MYSQL_TIME *ltime,uint fuzzydate);
1109
 
  bool get_time(MYSQL_TIME *ltime);
1110
 
};
1111
 
 
1112
 
 
1113
1025
class Field_time :public Field_str {
1114
1026
public:
1115
1027
  Field_time(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
1507
1419
#include "field/blob.h"
1508
1420
#include "field/null.h"
1509
1421
#include "field/year.h"
 
1422
#include "field/new_date.h"
 
1423
#include "field/new_decimal.h"
1510
1424
#include "field/datetime.h"
1511
1425
 
1512
1426
/*