~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/epoch.h

  • Committer: Stewart Smith
  • Date: 2011-03-29 01:30:47 UTC
  • mto: (2257.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2258.
  • Revision ID: stewart@flamingspork.com-20110329013047-5ujzfx6pahmwuko2
have CachedDirectory print out a warning if we can't stat() something in a directory. We should always have access to at least stat() things in directories Drizzle is running in (otherwise there is likely a problem)

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#ifndef DRIZZLED_FIELD_TIMESTAMP_H
22
 
#define DRIZZLED_FIELD_TIMESTAMP_H
 
21
#pragma once
23
22
 
24
23
#include <drizzled/field/str.h>
25
24
 
26
25
namespace drizzled
27
26
{
28
27
 
 
28
namespace field
 
29
{
 
30
 
29
31
class TableShare;
30
 
typedef struct charset_info_st CHARSET_INFO;
31
32
 
32
 
class Field_timestamp :public Field_str {
 
33
class Epoch :public Field_str {
33
34
public:
34
35
 
35
 
  using Field::val_int;
36
 
  using Field::val_str;
37
 
  using Field::cmp;
38
 
  using Field::store;
39
 
  Field_timestamp(unsigned char *ptr_arg,
40
 
                  uint32_t len_arg,
41
 
                  unsigned char *null_ptr_arg,
42
 
                  unsigned char null_bit_arg,
43
 
                  enum utype unireg_check_arg,
44
 
                  const char *field_name_arg,
45
 
                  TableShare *share,
46
 
                  const CHARSET_INFO * const cs);
47
 
  Field_timestamp(bool maybe_null_arg,
48
 
                  const char *field_name_arg,
49
 
                  const CHARSET_INFO * const cs);
 
36
  typedef Epoch* pointer;
 
37
 
 
38
  Epoch(unsigned char *ptr_arg,
 
39
        unsigned char *null_ptr_arg,
 
40
        unsigned char null_bit_arg,
 
41
        enum utype unireg_check_arg,
 
42
        const char *field_name_arg,
 
43
        drizzled::TableShare *share);
 
44
 
 
45
  Epoch(bool maybe_null_arg,
 
46
        const char *field_name_arg);
 
47
 
50
48
  enum_field_types type() const { return DRIZZLE_TYPE_TIMESTAMP;}
51
49
  enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONGLONG; }
52
50
  enum Item_result cmp_type () const { return INT_RESULT; }
53
 
  int  store(const char *to,uint32_t length,
54
 
             const CHARSET_INFO * const charset);
55
 
  int  store(double nr);
56
 
  int  store(int64_t nr, bool unsigned_val);
 
51
 
 
52
  int store(const char *to,uint32_t length,
 
53
            const charset_info_st * const charset);
 
54
  int store(double nr);
 
55
  int store(int64_t nr, bool unsigned_val);
 
56
  int store_decimal(const type::Decimal *value);
 
57
 
57
58
  int  reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=ptr[4]=ptr[5]=ptr[6]=ptr[7]=0; return 0; }
58
 
  double val_real(void);
59
 
  int64_t val_int(void);
60
 
  String *val_str(String*,String *);
 
59
  double val_real(void) const;
 
60
  int64_t val_int(void) const;
 
61
  String *val_str(String*,String *) const;
61
62
  int cmp(const unsigned char *,const unsigned char *);
62
63
  void sort_string(unsigned char *buff,uint32_t length);
63
64
  uint32_t pack_length() const { return 8; }
64
 
  void sql_type(String &str) const;
65
 
  bool can_be_compared_as_int64_t() const { return true; }
 
65
  virtual void sql_type(String &str) const;
 
66
  virtual bool can_be_compared_as_int64_t() const { return true; }
66
67
  bool zero_pack() const { return 0; }
67
 
  void set_time();
 
68
  virtual void set_time();
68
69
  virtual void set_default();
69
70
 
70
71
  /* Get TIMESTAMP field value as seconds since begging of Unix Epoch */
71
 
  long get_timestamp(bool *null_value);
 
72
  virtual long get_timestamp(bool *null_value) const;
 
73
 
 
74
  virtual bool is_timestamp() const
 
75
  {
 
76
    return true;
 
77
  }
 
78
 
72
79
private:
73
 
  void store_timestamp(int64_t timestamp);
74
 
  bool get_date(DRIZZLE_TIME *ltime,uint32_t fuzzydate);
75
 
  bool get_time(DRIZZLE_TIME *ltime);
 
80
  bool get_date(type::Time &ltime,uint32_t fuzzydate) const;
 
81
  bool get_time(type::Time &ltime) const;
 
82
 
76
83
public:
77
 
  timestamp_auto_set_type get_auto_set_type() const;
 
84
  virtual timestamp_auto_set_type get_auto_set_type() const;
 
85
  static size_t max_string_length();
78
86
};
79
87
 
 
88
} /* namespace field */
80
89
} /* namespace drizzled */
81
90
 
82
 
#endif /* DRIZZLED_FIELD_TIMESTAMP_H */
83
91