C Driver API 3.0.0
API for the NuoDB C Driver Library
Loading...
Searching...
No Matches
temporal.h
Go to the documentation of this file.
1/* (C) Copyright 2015-2023 Dassault Systemes SE. All Rights Reserved. */
2
3#ifndef _NuoDB_TEMPORAL_H_
4#define _NuoDB_TEMPORAL_H_ 1
5
6#include <time.h>
7
8#ifndef _NUODB_UTILS_H_
9#include "nuodb/utils.h"
10#endif
11
12#ifndef _NUODB_STRUCTS_H_
13#include "nuodb/structs.h"
14#endif
15
16/* c-driver */
17#ifdef __cplusplus
18extern "C" {
19#endif
20
49
52
59{
61 int32_t nanoseconds;
62 int64_t milliseconds;
63
75 int (* getType)(NuoDB_Temporal* _this);
76
86 void (* setMilliSeconds)(NuoDB_Temporal* _this, int64_t millis);
87
99 int64_t (* getMilliSeconds)(NuoDB_Temporal* _this);
100
109 void (* setNanoSeconds)(NuoDB_Temporal* _this, int32_t nanos);
110
119 int32_t (* getNanoSeconds)(NuoDB_Temporal* _this);
120
130 NuoDB_Status (* setTimestamp)(NuoDB_Temporal* _this, struct tm* utc_time);
131
143 NuoDB_Status (* getTimestamp)(NuoDB_Temporal* _this, struct tm* utc_time);
144
160 NuoDB_Status (* setTimestampTZ)(NuoDB_Temporal* _this, const char* timeZoneId, struct tm* tz_time);
161
177 NuoDB_Status (* getTimestampTZ)(NuoDB_Temporal* _this, const char* timeZoneId, struct tm* tz_time);
178
190 NuoDB_Status (* setTimestampNuoDBTimezone)(NuoDB_Temporal* _this, const NuoDB_Timezone* timeZone, struct tm* tz_time);
191
203 NuoDB_Status (* getTimestampNuoDBTimezone)(NuoDB_Temporal* _this, const NuoDB_Timezone* timeZone, struct tm* tz_time);
204};
205
206
214NUODB_CAPI const NuoDB_Timezone* NUODB_CAPICALL NuoDB_Timezone_create(const char* timezoneId);
215
219NUODB_CAPI void NUODB_CAPICALL NuoDB_Timezone_free(const NuoDB_Timezone* timezone);
220
228NUODB_CAPI NuoDB_Temporal* NUODB_CAPICALL NuoDB_Temporal_create(NuoDB_Temporal_Type temporalType);
229
234NUODB_CAPI void NUODB_CAPICALL NuoDB_Temporal_init(NuoDB_Temporal* tm, NuoDB_Temporal_Type temporalType);
235
239NUODB_CAPI void NUODB_CAPICALL NuoDB_Temporal_free(NuoDB_Temporal* temporal);
240
241#ifdef __cplusplus
242} // extern "C" {
243#endif
244
245#endif /* end of: #ifndef _NuoDB_TEMPORAL_H_ */
enum NuoDB_Status_enum NuoDB_Status
Status codes used by the C Driver.
Definition error.h:130
Data structure used to represent temporal information.
Definition temporal.h:59
NuoDB_Status(* getTimestampTZ)(NuoDB_Temporal *_this, const char *timeZoneId, struct tm *tz_time)
Populate the tm time struct with the value from this timestamp based on the time zone being passed in...
Definition temporal.h:177
NuoDB_Status(* setTimestamp)(NuoDB_Temporal *_this, struct tm *utc_time)
Set this timestamp from the time specified in utc_time.
Definition temporal.h:130
NuoDB_Status(* setTimestampTZ)(NuoDB_Temporal *_this, const char *timeZoneId, struct tm *tz_time)
Set this timestamp from the time specified in tz_time using the time zone being passed in.
Definition temporal.h:160
void(* setNanoSeconds)(NuoDB_Temporal *_this, int32_t nanos)
Set the fractions of a second in the NuoDB_Temporal data structure with the specified number of nanos...
Definition temporal.h:109
NuoDB_Status(* setTimestampNuoDBTimezone)(NuoDB_Temporal *_this, const NuoDB_Timezone *timeZone, struct tm *tz_time)
Set this timestamp from the time specified in tz_time using the time zone being passed in.
Definition temporal.h:190
int32_t(* getNanoSeconds)(NuoDB_Temporal *_this)
Return the value of the fractional part of the corresponding NuoDB_Temporal data structure as nanosec...
Definition temporal.h:119
void(* setMilliSeconds)(NuoDB_Temporal *_this, int64_t millis)
Set the NuoDB_Temporal data structure with the specified number of milliseconds.
Definition temporal.h:86
NuoDB_Status(* getTimestamp)(NuoDB_Temporal *_this, struct tm *utc_time)
Populate the utc_time struct with the value from this timestamp based on the UTC time zone (versus th...
Definition temporal.h:143
int64_t(* getMilliSeconds)(NuoDB_Temporal *_this)
Return the value of the corresponding NuoDB_Temporal data structure as milliseconds.
Definition temporal.h:99
NuoDB_Status(* getTimestampNuoDBTimezone)(NuoDB_Temporal *_this, const NuoDB_Timezone *timeZone, struct tm *tz_time)
Populate the tm time struct with the value from this timestamp based on the time zone being passed in...
Definition temporal.h:203
int(* getType)(NuoDB_Temporal *_this)
Return the SQL type for the NuoDB_Temporal data structure.
Definition temporal.h:75
structs and typedefs.
NUODB_CAPI NuoDB_Temporal *NUODB_CAPICALL NuoDB_Temporal_create(NuoDB_Temporal_Type temporalType)
Create a NuoDB_Temporal data structure for the specified SQL type.
NUODB_CAPI void NUODB_CAPICALL NuoDB_Timezone_free(const NuoDB_Timezone *timezone)
Free the NuoDB_Timezone data structure.
NuoDB_Temporal_Type_enum
Enum defining constant temporal types used by NuoDB_Temporal.
Definition temporal.h:27
@ NUODB_TEMPORAL_TIMESTAMP_NO_TZ
SQL TIMESTAMP WITHOUT TIME ZONE type.
Definition temporal.h:46
@ NUODB_TEMPORAL_TIME
SQL TIME type.
Definition temporal.h:36
@ NUODB_TEMPORAL_DATE
SQL DATE type.
Definition temporal.h:31
@ NUODB_TEMPORAL_TIMESTAMP
SQL TIMESTAMP type.
Definition temporal.h:41
NUODB_CAPI void NUODB_CAPICALL NuoDB_Temporal_free(NuoDB_Temporal *temporal)
Free the NuoDB_Temporal data structure.
enum NuoDB_Temporal_Type_enum NuoDB_Temporal_Type
Constant temporal types used by NuoDB_Temporal.
Definition temporal.h:51
NUODB_CAPI const NuoDB_Timezone *NUODB_CAPICALL NuoDB_Timezone_create(const char *timezoneId)
Create a NuoDB_Timezone data structure for the specified timezone id.
NUODB_CAPI void NUODB_CAPICALL NuoDB_Temporal_init(NuoDB_Temporal *tm, NuoDB_Temporal_Type temporalType)
Initialize a NuoDB_Temporal data structure with the specified SQL type.
NuoDB utilities.