~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/timestamp.h

Moved base64.h to mysys.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* - mode: c++ c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
4
 *  Copyright (C) 2008 MySQL
21
21
#ifndef DRIZZLE_SERVER_FIELD_TIMESTAMP
22
22
#define DRIZZLE_SERVER_FIELD_TIMESTAMP
23
23
 
 
24
#include "mysql_priv.h"
 
25
 
24
26
class Field_timestamp :public Field_str {
25
27
public:
26
 
  Field_timestamp(unsigned char *ptr_arg, uint32_t len_arg,
27
 
                  unsigned char *null_ptr_arg, unsigned char null_bit_arg,
 
28
  Field_timestamp(uchar *ptr_arg, uint32_t len_arg,
 
29
                  uchar *null_ptr_arg, uchar null_bit_arg,
28
30
                  enum utype unireg_check_arg, const char *field_name_arg,
29
 
                  TABLE_SHARE *share, const CHARSET_INFO * const cs);
 
31
                  TABLE_SHARE *share, CHARSET_INFO *cs);
30
32
  Field_timestamp(bool maybe_null_arg, const char *field_name_arg,
31
 
                  const CHARSET_INFO * const cs);
 
33
                  CHARSET_INFO *cs);
32
34
  enum_field_types type() const { return DRIZZLE_TYPE_TIMESTAMP;}
33
35
  enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
34
36
  enum Item_result cmp_type () const { return INT_RESULT; }
35
 
  int  store(const char *to,uint32_t length, const CHARSET_INFO * const charset);
 
37
  int  store(const char *to,uint length,CHARSET_INFO *charset);
36
38
  int  store(double nr);
37
39
  int  store(int64_t nr, bool unsigned_val);
38
40
  int  reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; }
40
42
  int64_t val_int(void);
41
43
  String *val_str(String*,String *);
42
44
  bool send_binary(Protocol *protocol);
43
 
  int cmp(const unsigned char *,const unsigned char *);
44
 
  void sort_string(unsigned char *buff,uint32_t length);
 
45
  int cmp(const uchar *,const uchar *);
 
46
  void sort_string(uchar *buff,uint length);
45
47
  uint32_t pack_length() const { return 4; }
46
48
  void sql_type(String &str) const;
47
49
  bool can_be_compared_as_int64_t() const { return true; }
56
58
      Field::set_default();
57
59
  }
58
60
  /* Get TIMESTAMP field value as seconds since begging of Unix Epoch */
59
 
  inline long get_timestamp(bool *null_value)
 
61
  inline long get_timestamp(my_bool *null_value)
60
62
  {
61
63
    if ((*null_value= is_null()))
62
64
      return 0;
79
81
#endif
80
82
      longstore(ptr,(uint32_t) timestamp);
81
83
  }
82
 
  bool get_date(DRIZZLE_TIME *ltime,uint32_t fuzzydate);
83
 
  bool get_time(DRIZZLE_TIME *ltime);
 
84
  bool get_date(MYSQL_TIME *ltime,uint fuzzydate);
 
85
  bool get_time(MYSQL_TIME *ltime);
84
86
  timestamp_auto_set_type get_auto_set_type() const;
85
87
};
86
88