18
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
#ifndef DRIZZLED_FIELD_TIMESTAMP_H
22
#define DRIZZLED_FIELD_TIMESTAMP_H
21
#ifndef DRIZZLE_SERVER_FIELD_TIMESTAMP
22
#define DRIZZLE_SERVER_FIELD_TIMESTAMP
24
24
#include <drizzled/field/str.h>
26
typedef struct st_table_share TABLE_SHARE;
30
27
typedef struct charset_info_st CHARSET_INFO;
32
29
class Field_timestamp :public Field_str {
39
Field_timestamp(unsigned char *ptr_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,
46
const CHARSET_INFO * const cs);
47
Field_timestamp(bool maybe_null_arg,
48
const char *field_name_arg,
31
Field_timestamp(unsigned char *ptr_arg, uint32_t len_arg,
32
unsigned char *null_ptr_arg, unsigned char null_bit_arg,
33
enum utype unireg_check_arg, const char *field_name_arg,
34
TABLE_SHARE *share, const CHARSET_INFO * const cs);
35
Field_timestamp(bool maybe_null_arg, const char *field_name_arg,
49
36
const CHARSET_INFO * const cs);
50
37
enum_field_types type() const { return DRIZZLE_TYPE_TIMESTAMP;}
51
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONGLONG; }
38
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
52
39
enum Item_result cmp_type () const { return INT_RESULT; }
53
40
int store(const char *to,uint32_t length,
54
41
const CHARSET_INFO * const charset);
55
42
int store(double nr);
56
43
int store(int64_t nr, bool unsigned_val);
57
int reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=ptr[4]=ptr[5]=ptr[6]=ptr[7]=0; return 0; }
44
int reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; }
58
45
double val_real(void);
59
46
int64_t val_int(void);
60
47
String *val_str(String*,String *);
48
bool send_binary(Protocol *protocol);
61
49
int cmp(const unsigned char *,const unsigned char *);
62
50
void sort_string(unsigned char *buff,uint32_t length);
63
uint32_t pack_length() const { return 8; }
51
uint32_t pack_length() const { return 4; }
64
52
void sql_type(String &str) const;
65
53
bool can_be_compared_as_int64_t() const { return true; }
66
54
bool zero_pack() const { return 0; }
70
58
/* Get TIMESTAMP field value as seconds since begging of Unix Epoch */
71
59
long get_timestamp(bool *null_value);
73
void store_timestamp(int64_t timestamp);
60
void store_timestamp(time_t timestamp);
74
61
bool get_date(DRIZZLE_TIME *ltime,uint32_t fuzzydate);
75
62
bool get_time(DRIZZLE_TIME *ltime);
77
63
timestamp_auto_set_type get_auto_set_type() const;
80
} /* namespace drizzled */
82
#endif /* DRIZZLED_FIELD_TIMESTAMP_H */