~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field.h

  • Committer: Brian Aker
  • Date: 2010-12-16 02:16:37 UTC
  • mto: This revision was merged to the branch mainline in revision 1999.
  • Revision ID: brian@tangent.org-20101216021637-owmmneuy57ddhcn3
uuid type code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
  /* Prevent use of these */
81
81
  Field(const Field&);
82
82
  void operator=(Field &);
 
83
 
83
84
public:
84
85
  unsigned char *ptr; /**< Position to field in record. Stores raw field value */
85
86
  unsigned char *null_ptr; /**< Byte where null_bit is */
179
180
  virtual int store(double nr)=0;
180
181
  virtual int store(int64_t nr, bool unsigned_val)=0;
181
182
  virtual int store_decimal(const my_decimal *d)=0;
182
 
  int store(const char *to,
183
 
            uint32_t length,
184
 
            const CHARSET_INFO * const cs,
185
 
            enum_check_fields check_level);
 
183
  int store_and_check(enum_check_fields check_level,
 
184
                      const char *to,
 
185
                      uint32_t length,
 
186
                      const CHARSET_INFO * const cs);
186
187
  /**
187
188
    This is called when storing a date in a string.
188
189
 
190
191
      Needs to be changed if/when we want to support different time formats.
191
192
  */
192
193
  virtual int store_time(DRIZZLE_TIME *ltime, enum enum_drizzle_timestamp_type t_type);
193
 
  virtual double val_real(void)=0;
194
 
  virtual int64_t val_int(void)=0;
 
194
  virtual double val_real()=0;
 
195
  virtual int64_t val_int()=0;
195
196
  virtual my_decimal *val_decimal(my_decimal *);
196
 
  inline String *val_str(String *str)
 
197
  String *val_str_internal(String *str)
197
198
  {
198
199
    return val_str(str, str);
199
200
  }
307
308
  virtual uint32_t key_length() const;
308
309
  virtual enum_field_types type() const =0;
309
310
  virtual enum_field_types real_type() const;
310
 
  inline  int cmp(const unsigned char *str) { return cmp(ptr,str); }
311
 
  virtual int cmp_max(const unsigned char *a, const unsigned char *b,
312
 
                      uint32_t max_len);
 
311
  virtual int cmp_max(const unsigned char *a, const unsigned char *b, uint32_t max_len);
313
312
  virtual int cmp(const unsigned char *,const unsigned char *)=0;
 
313
  int cmp_internal(const unsigned char *str) { return cmp(ptr,str); }
314
314
  virtual int cmp_binary(const unsigned char *a,const unsigned char *b,
315
315
                         uint32_t max_length=UINT32_MAX);
316
316
  virtual int cmp_offset(uint32_t row_offset);
362
362
                               uint32_t new_null_bit);
363
363
  /** This is used to generate a field in Table from TableShare */
364
364
  Field *clone(memory::Root *mem_root, Table *new_table);
365
 
  inline void move_field(unsigned char *ptr_arg,unsigned char *null_ptr_arg,unsigned char null_bit_arg)
 
365
  void move_field(unsigned char *ptr_arg,unsigned char *null_ptr_arg,unsigned char null_bit_arg)
366
366
  {
367
367
    ptr= ptr_arg;
368
368
    null_ptr= null_ptr_arg;
369
369
    null_bit= null_bit_arg;
370
370
  }
371
 
  inline void move_field(unsigned char *ptr_arg) { ptr=ptr_arg; }
 
371
  void move_field(unsigned char *ptr_arg) { ptr=ptr_arg; }
372
372
  virtual void move_field_offset(ptrdiff_t ptr_diff)
373
373
  {
374
374
    ptr= ADD_TO_PTR(ptr,ptr_diff, unsigned char*);
426
426
  {
427
427
    set_image(buff,length, &my_charset_bin);
428
428
  }
429
 
  inline int64_t val_int_offset(uint32_t row_offset)
 
429
  int64_t val_int_offset(uint32_t row_offset)
430
430
  {
431
431
    ptr+=row_offset;
432
432
    int64_t tmp=val_int();
434
434
    return tmp;
435
435
  }
436
436
 
437
 
  inline int64_t val_int(const unsigned char *new_ptr)
 
437
  int64_t val_int_internal(const unsigned char *new_ptr)
438
438
  {
439
439
    unsigned char *old_ptr= ptr;
440
440
    int64_t return_value;
443
443
    ptr= old_ptr;
444
444
    return return_value;
445
445
  }
446
 
  inline String *val_str(String *str, const unsigned char *new_ptr)
 
446
 
 
447
  String *val_str_internal(String *str, const unsigned char *new_ptr)
447
448
  {
448
449
    unsigned char *old_ptr= ptr;
449
450
    ptr= const_cast<unsigned char*>(new_ptr);
450
 
    val_str(str);
 
451
    val_str_internal(str);
451
452
    ptr= old_ptr;
452
453
    return str;
453
454
  }
556
557
    return max_length;
557
558
  }
558
559
 
559
 
  inline uint32_t offset(const unsigned char *record)
 
560
  uint32_t offset(const unsigned char *record)
560
561
  {
561
562
    return (uint32_t) (ptr - record);
562
563
  }
654
655
                            const uint32_t code,
655
656
                            double nr,
656
657
                            enum enum_drizzle_timestamp_type ts_type);
657
 
  inline bool check_overflow(int op_result)
 
658
  bool check_overflow(int op_result)
658
659
  {
659
660
    return (op_result == E_DEC_OVERFLOW);
660
661
  }
692
693
                                  bool unsigned_flag,
693
694
                                  int *err);
694
695
  /* The max. number of characters */
695
 
  inline uint32_t char_length() const
 
696
  uint32_t char_length() const
696
697
  {
697
698
    return field_length / charset()->mbmaxlen;
698
699
  }
699
700
 
700
 
  inline enum column_format_type column_format() const
 
701
  enum column_format_type column_format() const
701
702
  {
702
703
    return (enum column_format_type)
703
704
      ((flags >> COLUMN_FORMAT_FLAGS) & COLUMN_FORMAT_MASK);
726
727
  void setWriteSet(bool arg= true);
727
728
};
728
729
 
 
730
std::ostream& operator<<(std::ostream& output, const Field &field);
 
731
 
729
732
} /* namespace drizzled */
730
733
 
731
734
/** @TODO Why is this in the middle of the file???*/