drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
drizzled::DateTime Class Reference

#include <temporal.h>

Inheritance diagram for drizzled::DateTime:
[legend]
Collaboration diagram for drizzled::DateTime:
[legend]

Public Member Functions

bool in_unix_epoch () const
virtual bool is_valid () const
void to_int32_t (int32_t *) const
bool from_int32_t (int32_t)
virtual int to_string (char *to, size_t to_len) const
bool from_string (const char *from, size_t from_len)
void to_int64_t (int64_t *to) const
bool from_time_t (const time_t from)
bool from_timeval (struct timeval &_timeval)
bool from_int64_t (const int64_t from, bool convert)
bool from_int64_t (const int64_t from)
void to_tm (struct tm *to) const
void to_decimal (type::Decimal *to) const
Public Member Functions inherited from drizzled::Date
virtual bool operator== (const Date &rhs)
virtual bool operator!= (const Date &rhs)
virtual bool operator> (const Date &rhs)
virtual bool operator>= (const Date &rhs)
virtual bool operator< (const Date &rhs)
virtual bool operator<= (const Date &rhs)
virtual bool operator== (const DateTime &rhs)
virtual bool operator!= (const DateTime &rhs)
virtual bool operator> (const DateTime &rhs)
virtual bool operator>= (const DateTime &rhs)
virtual bool operator< (const DateTime &rhs)
virtual bool operator<= (const DateTime &rhs)
virtual bool operator== (const Timestamp &rhs)
virtual bool operator!= (const Timestamp &rhs)
virtual bool operator> (const Timestamp &rhs)
virtual bool operator>= (const Timestamp &rhs)
virtual bool operator< (const Timestamp &rhs)
virtual bool operator<= (const Timestamp &rhs)
const Date operator- (const Date &rhs)
const Date operator+ (const Date &rhs)
Date & operator+= (const Date &rhs)
Date & operator-= (const Date &rhs)
const Date operator- (const Time &rhs)
const Date operator+ (const Time &rhs)
Date & operator-= (const Time &rhs)
Date & operator+= (const Time &rhs)
const Date operator- (const DateTime &rhs)
const Date operator+ (const DateTime &rhs)
Date & operator+= (const DateTime &rhs)
Date & operator-= (const DateTime &rhs)
Date & operator= (const DateTime &rhs)
virtual bool is_valid_date () const
virtual bool is_valid_datetime () const
virtual bool is_valid_time () const
virtual bool is_valid_timestamp () const
void to_julian_day_number (int64_t *to) const
bool from_julian_day_number (const int64_t from)
virtual bool from_tm (const struct tm *from)
virtual void to_time_t (time_t &to) const
Public Member Functions inherited from drizzled::Temporal
enum calendar calendar () const
void set_nseconds (const uint32_t nsecond)
uint32_t nseconds () const
void set_useconds (const uint32_t usecond)
uint32_t useconds () const
void set_epoch_seconds ()
void set_epoch_seconds (const uint32_t epoch_second)
time_t epoch_seconds () const
void set_seconds (const uint32_t second)
uint32_t seconds () const
void set_minutes (const uint32_t minute)
uint32_t minutes () const
void set_hours (const uint32_t hour)
uint32_t hours () const
void set_days (const uint32_t day)
uint32_t days () const
void set_months (const uint32_t month)
uint32_t months () const
void set_years (const uint32_t year)
uint32_t years () const
bool overflow () const

Static Public Attributes

static const int MAX_STRING_LENGTH = 27
Static Public Attributes inherited from drizzled::Date
static const int MAX_STRING_LENGTH = 11

Friends

class TemporalInterval
class Timestamp

Additional Inherited Members

Protected Member Functions inherited from drizzled::Temporal
uint64_t _cumulative_seconds_in_time () const
void _reset ()
Protected Attributes inherited from drizzled::Temporal
enum calendar _calendar
uint32_t _years
uint32_t _months
uint32_t _days
uint32_t _hours
uint32_t _minutes
uint32_t _seconds
time_t _epoch_seconds
uint32_t _useconds
uint32_t _nseconds
bool _overflow

Detailed Description

Class representing temporal components in a valid SQL datetime range, including a time component

Definition at line 570 of file temporal.h.

Constructor & Destructor Documentation

◆ DateTime()

drizzled::DateTime::DateTime ( )
inline

Definition at line 573 of file temporal.h.

Member Function Documentation

◆ from_int32_t()

bool drizzled::DateTime::from_int32_t ( int32_t from)
inlinevirtual

Attempts to populate the Date instance based on the contents of a supplied 4-byte integer.

Returns whether the conversion was successful.

Parameters
Integerto convert from

Ignore overflow and pass-through to DateTime::from_int64_t()

Reimplemented from drizzled::Date.

Definition at line 589 of file temporal.h.

◆ from_int64_t() [1/2]

bool drizzled::DateTime::from_int64_t ( const int64_t from)
inline

Definition at line 656 of file temporal.h.

◆ from_int64_t() [2/2]

bool drizzled::DateTime::from_int64_t ( const int64_t from,
bool convert )

Attempts to populate the DateTime instance based on the contents of a supplied 8-byte integer.

Returns whether the conversion was successful.

Parameters
Integerto convert from
convertif conversion to canonical representation should be attempted

We try to intepret the incoming number as a datetime "string". This is pretty much a hack for usability, but keeps us compatible with MySQL.

Definition at line 1106 of file temporal.cc.

◆ from_string()

bool drizzled::DateTime::from_string ( const char * from,
size_t from_len )
virtual

Attempts to populate the DateTime instance based on the contents of a supplied string.

Returns whether the conversion was successful.

Parameters
Stringto convert from
Lengthof supplied string

Reimplemented from drizzled::Date.

Definition at line 122 of file temporal.cc.

◆ from_time_t()

bool drizzled::DateTime::from_time_t ( const time_t from)
virtual

Attempts to populate the DateTime instance based on the contents of a supplied time_t

Returns whether the conversion was successful.

Parameters
time_tto convert from

Reimplemented from drizzled::Date.

Definition at line 1260 of file temporal.cc.

◆ from_timeval()

bool drizzled::DateTime::from_timeval ( struct timeval & _timeval)

Definition at line 1234 of file temporal.cc.

◆ in_unix_epoch()

bool drizzled::DateTime::in_unix_epoch ( ) const
virtual

Returns whether the DateTime (or subclass) instance is in the Unix Epoch.

Reimplemented from drizzled::Date.

Definition at line 1161 of file temporal.cc.

◆ is_valid()

bool drizzled::DateTime::is_valid ( ) const
virtual

Returns whether the temporal value is valid datetime.

Reimplemented from drizzled::Date.

Reimplemented in drizzled::MicroTimestamp, drizzled::NanoTimestamp, and drizzled::Timestamp.

Definition at line 1345 of file temporal.cc.

◆ to_decimal()

void drizzled::DateTime::to_decimal ( type::Decimal * to) const
virtual

Fills a supplied type::Decimal with a representation of the DateTime value.

Parameters
Pointerto the type::Decimal to fill

Reimplemented from drizzled::Date.

Definition at line 1002 of file temporal.cc.

◆ to_int32_t()

void drizzled::DateTime::to_int32_t ( int32_t * ) const
inlinevirtual

It's not possible to convert to and from a DateTime and a 4-byte integer, so let us know if we try and do it!

Reimplemented from drizzled::Date.

Definition at line 588 of file temporal.h.

◆ to_int64_t()

void drizzled::DateTime::to_int64_t ( int64_t * to) const
virtual

Fills a supplied 8-byte integer pointer with an integer representation of the DateTime value.

Parameters
Integerto fill.

Reimplemented from drizzled::Date.

Definition at line 1035 of file temporal.cc.

◆ to_string()

int drizzled::DateTime::to_string ( char * to,
size_t to_len ) const
virtual

Fills a supplied char string with a string representation of the DateTime value.

Parameters
C-Stringto fill
Lengthof to C-String
Returns
length of string written (not including trailing '\0'). If output was truncated, returns length that would have been outputted.

Reimplemented from drizzled::Date.

Reimplemented in drizzled::MicroTimestamp.

Definition at line 961 of file temporal.cc.

◆ to_tm()

void drizzled::DateTime::to_tm ( struct tm * to) const
virtual

Fills a supplied tm pointer with an representation of the DateTime value.

Parameters
tmto fill.

Reimplemented from drizzled::Date.

Definition at line 1059 of file temporal.cc.

◆ TemporalInterval

friend class TemporalInterval
friend

Definition at line 575 of file temporal.h.

◆ Timestamp

friend class Timestamp
friend

Definition at line 677 of file temporal.h.

Member Data Documentation

◆ MAX_STRING_LENGTH

const int drizzled::DateTime::MAX_STRING_LENGTH = 27
static

Maximum length of C-String needed to represent type (including '\0').

Definition at line 608 of file temporal.h.


The documentation for this class was generated from the following files: