Public member functions documentation
NzaeTimestampField addInterval(const NzaeIntervalField &interval) const
Constructs a TimestampField by adding an interval.
Parameters
NzaeIntervalField interval
The NzaeIntevalField value.
Returns
NzaeTimestampField
The TimestampField, consisting of Interval plus Timestamp.
NzaeIntervalField age(const NzaeTimestampField &x) const
Constructs an IntervalField by subtracting a timestamp.
Parameters
NzaeTimestampField x
The NzaeTimeStampField value.
Returns
NzaeIntervalField
The IntervalField, consisting of timestamp minus timestamp.
This function returns a more detailed answer than subTimestamp
void decodeTimestamp(uint8_t *month, uint8_t *day, uint16_t *year, uint8_t *hour, uint8_t
*minute, uint8_t *second, uint32_t *mcrs, bool *errorFlag=NULL) const
Converts a Netezza-encoded Timestamp value to m/d/y, h:m:s:micros.
Parameters
day
The day count, 1 to 31 inclusive.
month
The month number, 1 to 12 inclusive.
year
The year number, SQL_YEAR_MIN to SQL_YEAR_MAX inclusive.
hour
The hour, 0 to 23 inclusive.
minute
The minute, 0 to 59 inclusive.
second
The second, 0 to 59 inclusive.
mcrs
The microsecond, 0 to 999,999 inclusive.
errorFlag
If not NULL, *set to TRUE if isValidTimestamp(encodedTimestamp) is FALSE; *set to FALSE
otherwise.
Exceptions
NzaeException
void decodeTimestamp(time_t *result, bool *errorFlag=NULL) const
Converts a Netezza-encoded Timestamp value to time_t. Drops the microseconds after the last
whole minute of the timestamp value.
Parameters
result
The resulting time_t value. Forced to be signed int32.
errorFlag
If not NULL, *set to TRUE if isValidTimestamp(encodedTimestamp) is FALSE; *set to FALSE
otherwise.
Exceptions
NzaeException
void decodeTimestamp(struct timeval *result, bool *errorFlag=NULL) const
Converts a Netezza-encoded Timestamp value to struct timeval.
Parameters
result
The resulting time_t value. Forced to be signed int32.
errorFlag
If not NULL, *set to TRUE if isValidTimestamp(encodedTimestamp) is FALSE; *set to FALSE
otherwise.
Exceptions
NzaeException
void decodeTimestamp(struct tm *result, bool *errorFlag=NULL) const
Converts a Netezza-encoded Timestamp value to struct tm. Drops the microseconds after the last
whole minute of the timestamp value.
Parameters
result
The structure where the decoded Timestamp is written, such that result->tm_hour, result-
>tm_min, result->tm_sec, result->tm_year, result->tm_mon, result->tm_mday, result->tm_yday, and
result->tm_wday contain the appropriate fields in tm format. Result->tm_isdst is set to -1; if
applicable, all other field of result are set to 0.
errorFlag
If not NULL, *set to TRUE if isValidTimestamp(encodedTimestamp) is FALSE; *set to FALSE
otherwise.
Exceptions
NzaeException
void encodeTimestamp(uint32_t month, uint32_t day, uint32_t year, uint32_t hour, uint32_t
minute, uint32_t second, uint32_t mcrs, bool *errorFlag=NULL)
Converts a m/d/y, h:m:s:micros Timestamp value to a Netezza-encoded Timestamp.
Parameters
day
The day count, 1 to 31 inclusive.
month
The month number, 1 to 12 inclusive.
year
The year number, SQL_YEAR_MIN to SQL_YEAR_MAX inclusive.
hour
The hour, 0 to 23 inclusive.
minute
The minute, 0 to 59 inclusive.
second
The second, 0 to 59 inclusive.
mcrs
The microsecond, 0 to 999,999 inclusive.
errorFlag
If not NULL, *set to TRUE if isValidTimestamp(encodedTimestamp) is FALSE; *set to FALSE
otherwise.
Exceptions
NzaeException
void encodeTimestamp(time_t ts, bool *errorFlag=NULL)
Converts a time_t value to a Netezza-encoded Timestamp. Encodes the value in UTC and applies no
offsets. Adds 0 microseconds to the encoded value.
Parameters
ts
The time_t Timestamp value.
errorFlag
If not NULL, *set to TRUE if isValidEpoch(ts) is FALSE; *set to FALSE otherwise.
Exceptions
NzaeException
void encodeTimestamp(const struct timeval &ts, bool *errorFlag=NULL)
Converts a struct timeval value to a Netezza-encoded Timestamp.
Parameters
ts
The time_t Timestamp value.
errorFlag
If not NULL, *set to TRUE if isValidTimeVal(ts) is FALSE; *set to FALSE otherwise.
Exceptions
NzaeException
void encodeTimestamp(const struct tm &ts, bool *errorFlag=NULL)
Converts a struct tm value to a Netezza-encoded Timestamp. Uses only the ts.tm_year, ts.tm_day,
ts.tm_mon, ts.tm_hour, ts.tm_min and ts.tm_sec fields of ts, ignoring the remaining fields. The
value specified for ts must pass isValidTimeStruct(). Adds 0 microseconds to the encoded value.
Parameters
ts
The time_t Timestamp value.
errorFlag
If not NULL, *set to TRUE if isValidTimeStruct(ts) is FALSE; *set to FALSE otherwise.
Exceptions
NzaeException
void fromString(std::string str)
Constructs a field from the string.
Parameters
str
The string to assign from.
bool isValidEpochTimestamp() const
Determines whether a Netezza-encoded Timestamp value is valid and within the time_t Epoch
range.
Returns
FALSE if encodedTimestamp< EPOCH_START_AS_TIMESTAMP or
encodedTimestamp>EPOCH_END_AS_TIMESTAMP; TRUE otherwise.
bool isValidTimestamp() const
Determines whether a Netezza-encoded Timestamp value is valid and within range.
Returns
FALSE if encodedTimestamp< ENC_TIMESTAMP_MIN or encodedTimestamp>ENC_TIMESTAMP_MAX; TRUE
otherwise.
NzaeTimestampField(const NzaeTimestampField &field)
Constructs a timestamp field with value field.
Parameters
NzaeTimestampField field
The NzaeTimeStampField value.
NzaeTimestampField(int64_t val)
Constructs a timestamp field with value val.
Parameters
val
The encoded timestamp value.
NzaeTimestampField(const NzaeDateField &field)
Constructs a timestamp field with value field.
Parameters
NzaeDateField field
The NzaeDateField value.
NzaeTimestampField()
Constructs a NULL timestamp field.
void offsetTimestamp(int32_t sqlOffset, bool *errorFlag=NULL)
Applies an offset to an NZ Timestamp.
Parameters
NzaeDateField field
The time offset in minutes, SQL_OFFSET_MIN to SQL_OFFSET_MAX inclusive.
errorFlag
If not NULL, *set to TRUE if isValidSqlOffset(sqlOffset) is FALSE, or
isValidTimestamp(nzTimestamp) is FALSE or isValidTimestamp(nzTimestamp+sqlOffset* 60*1,000,000) is
FALSE; *set to FALSE otherwise.
Exceptions
NzaeException
operator int64_t() const
Returns the encoded field value.
Returns
The encoded value.
operator NzaeDateField() const
Returns the date field value.
Returns
The date value converted from the timestamp
operator NzaeTimeField() const
Returns the time field value.
Returns
The time value converted from the timestamp.
operator NzaeTimeTzField() const
Returns the timetz field value.
Returns
The timetz value converted from the timestamp.
NzaeTimestampField& operator=(const NzaeTimestampField &field)
Assigns the value of the argument to a field object.
Parameters
NzaeTimestampField field
The field to assign.
Returns
NzaeTimestampField
NzaeTimestampField& operator=(const NzaeDateField &field)
Assigns the value of the argument to a field object.
Parameters
NzaeDateField field
The field to assign.
Returns
NzaeTimestampField
NzaeTimestampField& operator=(NzaeField &field)
Assigns the value of the argument to a field object.
Parameters
NzaeField
The field to assign.
Returns
NzaeTimestampField
The field argument may be a different type, as long as it is compatible.
NzaeTimestampField& operator=(int64_t val)
Assigns the value of the argument to a field object.
Parameters
val
The encoded value to assign.
Returns
NzaeTimestampField
NzaeTimestampField subInterval(const NzaeIntervalField &interval) const
Constructs a TimestampField by subtracting an interval.
Parameters
NzaeIntervalField interval
The NzaeIntevalField value.
Returns
NzaeTimestampField
The TimestampField, consisting of Timestamp minus interval.
NzaeIntervalField subTimestamp(const NzaeTimestampField &x) const
Constructs an IntervalField by subtracting a timestamp.
Parameters
NzaeTimestampField x
The NzaeTimestampField value.
Returns
NzaeIntervalField
The IntervalField, consisting of Timestamp minus Timestamp.
std::string toString() const
Returns the string representation of the field.
Returns
The string representation.
virtual NzaeDataTypes::Types type() const
Returns the type of the field.
Returns
Types
The field type.