CUBRID Engine  latest
db_date.h File Reference
#include "dbtype_def.h"
#include <time.h>
Include dependency graph for db_date.h:

Go to the source code of this file.

Functions

int db_date_weekday (DB_DATE *date)
 
int db_date_to_string (char *buf, int bufsize, DB_DATE *date)
 
bool db_string_check_explicit_date (const char *str, int str_len)
 
int db_string_to_date (const char *buf, DB_DATE *date)
 
int db_string_to_date_ex (const char *buf, int str_len, DB_DATE *date)
 
int db_date_parse_date (char const *str, int str_len, DB_DATE *date)
 
int db_datetime_encode (DB_DATETIME *datetime, int month, int day, int year, int hour, int minute, int second, int millisecond)
 
int db_datetime_decode (const DB_DATETIME *datetime, int *month, int *day, int *year, int *hour, int *minute, int *second, int *millisecond)
 
int db_datetime_to_string (char *buf, int bufsize, DB_DATETIME *datetime)
 
int db_datetimetz_to_string (char *buf, int bufsize, DB_DATETIME *dt, const TZ_ID *tz_id)
 
int db_datetimeltz_to_string (char *buf, int bufsize, DB_DATETIME *dt)
 
int db_datetime_to_string2 (char *buf, int bufsize, DB_DATETIME *datetime)
 
int db_string_to_datetime (const char *str, DB_DATETIME *datetime)
 
int db_string_to_datetime_ex (const char *str, int str_len, DB_DATETIME *datetime)
 
int db_string_to_datetimetz (const char *str, DB_DATETIMETZ *dt_tz, bool *has_zone)
 
int db_string_to_datetimetz_ex (const char *str, int str_len, DB_DATETIMETZ *dt_tz, bool *has_zone)
 
int db_string_to_datetimeltz (const char *str, DB_DATETIME *datetime)
 
int db_string_to_datetimeltz_ex (const char *str, int str_len, DB_DATETIME *datetime)
 
int db_date_parse_datetime_parts (char const *str, int str_len, DB_DATETIME *date, bool *is_explicit_time, bool *has_explicit_msec, bool *fits_as_timestamp, char const **endp)
 
int db_date_parse_datetime (char const *str, int str_len, DB_DATETIME *datetime)
 
int db_subtract_int_from_datetime (DB_DATETIME *dt1, DB_BIGINT i2, DB_DATETIME *result_datetime)
 
int db_add_int_to_datetime (DB_DATETIME *datetime, DB_BIGINT i2, DB_DATETIME *result_datetime)
 
int db_timestamp_encode (DB_TIMESTAMP *utime, DB_DATE *date, DB_TIME *timeval)
 
int db_timestamp_encode_ses (const DB_DATE *date, const DB_TIME *timeval, DB_TIMESTAMP *utime, TZ_ID *dest_tz_id)
 
int db_timestamp_encode_sys (const DB_DATE *date, const DB_TIME *timeval, DB_TIMESTAMP *utime, TZ_ID *dest_tz_id)
 
int db_timestamp_encode_utc (const DB_DATE *date, const DB_TIME *timeval, DB_TIMESTAMP *utime)
 
int db_timestamp_decode_ses (const DB_TIMESTAMP *utime, DB_DATE *date, DB_TIME *timeval)
 
void db_timestamp_decode_utc (const DB_TIMESTAMP *utime, DB_DATE *date, DB_TIME *timeval)
 
int db_timestamp_decode_w_reg (const DB_TIMESTAMP *utime, const TZ_REGION *tz_region, DB_DATE *date, DB_TIME *timeval)
 
int db_timestamp_decode_w_tz_id (const DB_TIMESTAMP *utime, const TZ_ID *tz_id, DB_DATE *date, DB_TIME *timeval)
 
int db_timestamp_to_string (char *buf, int bufsize, DB_TIMESTAMP *utime)
 
int db_timestamptz_to_string (char *buf, int bufsize, DB_TIMESTAMP *utime, const TZ_ID *tz_id)
 
int db_timestampltz_to_string (char *buf, int bufsize, DB_TIMESTAMP *utime)
 
int db_string_to_timestamp (const char *buf, DB_TIMESTAMP *utime)
 
int db_string_to_timestamp_ex (const char *buf, int buf_len, DB_TIMESTAMP *utime)
 
int db_date_parse_timestamp (char const *str, int str_len, DB_TIMESTAMP *utime)
 
int db_string_to_timestamptz (const char *str, DB_TIMESTAMPTZ *ts_tz, bool *has_zone)
 
int db_string_to_timestamptz_ex (const char *str, int str_len, DB_TIMESTAMPTZ *ts_tz, bool *has_zone, bool is_cast)
 
int db_string_to_timestampltz (const char *str, DB_TIMESTAMP *ts)
 
int db_string_to_timestampltz_ex (const char *str, int str_len, DB_TIMESTAMP *ts)
 
int db_time_to_string (char *buf, int bufsize, DB_TIME *dbtime)
 
bool db_string_check_explicit_time (const char *str, int str_len)
 
int db_string_to_time (const char *buf, DB_TIME *dbtime)
 
int db_string_to_time_ex (const char *buf, int buf_len, DB_TIME *dbtime)
 
int db_date_parse_time (char const *str, int str_len, DB_TIME *time, int *milisec)
 
time_t db_mktime (DB_DATE *date, DB_TIME *timeval)
 
int db_strftime (char *s, int smax, const char *fmt, DB_DATE *date, DB_TIME *timeval)
 
void db_localtime (time_t *epoch_time, DB_DATE *date, DB_TIME *timeval)
 
void db_localdatetime (time_t *epoch_time, DB_DATETIME *datetime)
 
void db_localdatetime_msec (time_t *epoch_time, int millisecond, DB_DATETIME *datetime)
 
int julian_encode (int m, int d, int y)
 
void julian_decode (int jul, int *monthp, int *dayp, int *yearp, int *weekp)
 
int day_of_week (int jul_day)
 
bool is_leap_year (int year)
 
int db_tm_encode (struct tm *c_time_struct, DB_DATE *date, DB_TIME *timeval)
 
int db_get_day_of_year (int year, int month, int day)
 
int db_get_day_of_week (int year, int month, int day)
 
int db_get_week_of_year (int year, int month, int day, int mode)
 
int db_check_time_date_format (const char *format_s)
 
int db_add_weeks_and_days_to_date (int *day, int *month, int *year, int weeks, int day_week)
 

Function Documentation

int day_of_week ( int  jul_day)

Definition at line 176 of file db_date.c.

References IGREG_SPECIAL.

Referenced by db_date_weekday(), db_get_date_weekday(), get_date_weekday(), get_day(), round_date(), and truncate_date().

Here is the caller graph for this function:

int db_add_weeks_and_days_to_date ( int *  day,
int *  month,
int *  year,
int  weeks,
int  day_week 
)

Definition at line 5009 of file db_date.c.

References ER_FAILED, i, IS_LEAP_YEAR, NO_ERROR, and NULL.

Referenced by db_str_to_date().

Here is the caller graph for this function:

int db_check_time_date_format ( const char *  format_s)

Definition at line 4914 of file db_date.c.

References DATE_SPECIFIER, DATETIME_SPECIFIER, DATETIMETZ_SPECIFIER, i, ampm_buf::len, strlen, and TIME_SPECIFIER.

Referenced by db_str_to_date(), and pt_eval_expr_type().

Here is the caller graph for this function:

int db_date_parse_date ( char const str,
int  str_len,
DB_DATE date 
)

Definition at line 3481 of file db_date.c.

References ARG_FILE_LINE, db_datetime::date, db_date_parse_datetime(), er_clear(), ER_DATE_CONVERSION, ER_ERROR_SEVERITY, er_set(), err, and NO_ERROR.

Referenced by tp_atodate().

Here is the caller graph for this function:

int db_date_parse_datetime ( char const str,
int  str_len,
DB_DATETIME datetime 
)

Definition at line 3423 of file db_date.c.

References db_date_parse_datetime_parts(), and NULL.

Referenced by db_date_parse_date(), db_date_parse_timestamp(), and tp_atoudatetime().

Here is the caller graph for this function:

int db_date_parse_datetime_parts ( char const str,
int  str_len,
DB_DATETIME date,
bool is_explicit_time,
bool has_explicit_msec,
bool fits_as_timestamp,
char const **  endp 
)
int db_date_parse_time ( char const str,
int  str_len,
DB_TIME time,
int *  milisec 
)
int db_date_parse_timestamp ( char const str,
int  str_len,
DB_TIMESTAMP utime 
)
int db_date_weekday ( DB_DATE date)

Definition at line 321 of file db_date.c.

References day_of_week().

Referenced by date_as_string(), db_datetime_string(), db_string_date(), db_timestamp_string(), and fmt_date_value().

Here is the caller graph for this function:

int db_datetime_to_string2 ( char *  buf,
int  bufsize,
DB_DATETIME datetime 
)

Definition at line 4375 of file db_date.c.

References db_datetime_decode(), and NULL.

Referenced by la_log_page_check().

Here is the caller graph for this function:

int db_datetimeltz_to_string ( char *  buf,
int  bufsize,
DB_DATETIME dt 
)
int db_get_day_of_week ( int  year,
int  month,
int  day 
)
int db_get_day_of_year ( int  year,
int  month,
int  day 
)

Definition at line 4697 of file db_date.c.

References i, and IS_LEAP_YEAR.

Referenced by db_get_date_dayofyear(), db_get_date_totaldays(), db_get_week_of_year(), and db_time_diff().

Here is the caller graph for this function:

int db_get_week_of_year ( int  year,
int  month,
int  day,
int  mode 
)

Definition at line 4854 of file db_date.c.

References assert, db_get_day_of_year(), get_end_of_week_one_of_year(), and IS_LEAP_YEAR.

Referenced by db_get_date_week().

Here is the caller graph for this function:

void db_localdatetime_msec ( time_t *  epoch_time,
int  millisecond,
DB_DATETIME datetime 
)

Definition at line 1044 of file db_date.c.

References db_datetime_encode(), and NULL.

Referenced by db_localdatetime(), logtb_descriptors_start_scan(), and showstmt_array_end_scan().

Here is the caller graph for this function:

void db_localtime ( time_t *  epoch_time,
DB_DATE date,
DB_TIME timeval 
)

Definition at line 1000 of file db_date.c.

References encode_time(), julian_encode(), and NULL.

time_t db_mktime ( DB_DATE date,
DB_TIME timeval 
)

Definition at line 557 of file db_date.c.

References NO_ERROR, and tm_encode().

Referenced by catcls_get_apply_info_log_record_time().

Here is the caller graph for this function:

int db_strftime ( char *  s,
int  smax,
const char *  fmt,
DB_DATE date,
DB_TIME timeval 
)

Definition at line 973 of file db_date.c.

References db_tm_encode(), and NO_ERROR.

Referenced by double_to_string(), and pt_xasl_data_type_to_domain().

Here is the caller graph for this function:

bool db_string_check_explicit_date ( const char *  str,
int  str_len 
)

Definition at line 3629 of file db_date.c.

References char_isspace(), NULL, and parse_date().

Referenced by pt_check_and_coerce_to_date().

Here is the caller graph for this function:

bool db_string_check_explicit_time ( const char *  str,
int  str_len 
)

Definition at line 1331 of file db_date.c.

References NULL, and parse_mtime().

Referenced by pt_check_and_coerce_to_time().

Here is the caller graph for this function:

int db_string_to_date ( const char *  buf,
DB_DATE date 
)

Definition at line 3693 of file db_date.c.

References db_string_to_date_ex(), and strlen.

Referenced by db_string_value(), jsp_unpack_date_value(), ldr_check_date_time_conversion(), ldr_date_elem(), pt_db_value_initialize(), and cubload::to_db_date().

Here is the caller graph for this function:

int db_string_to_date_ex ( const char *  buf,
int  str_len,
DB_DATE date 
)

Definition at line 3661 of file db_date.c.

References ARG_FILE_LINE, char_isspace(), ER_DATE_CONVERSION, er_set(), ER_WARNING_SEVERITY, NO_ERROR, NULL, p, and parse_date().

Referenced by db_string_extract_dbval(), db_string_to_date(), and db_to_date().

Here is the caller graph for this function:

int db_string_to_datetime ( const char *  str,
DB_DATETIME datetime 
)
int db_string_to_datetime_ex ( const char *  str,
int  str_len,
DB_DATETIME datetime 
)

Definition at line 4414 of file db_date.c.

References ARG_FILE_LINE, char_isspace(), ER_DATE_CONVERSION, er_set(), ER_WARNING_SEVERITY, NO_ERROR, NULL, p, and parse_datetime().

Referenced by db_string_extract_dbval(), db_string_to_datetime(), and db_to_datetime().

Here is the caller graph for this function:

int db_string_to_datetimeltz ( const char *  str,
DB_DATETIME datetime 
)

Definition at line 4555 of file db_date.c.

References db_string_to_datetimeltz_ex(), and strlen.

Referenced by ldr_check_date_time_conversion(), ldr_datetimeltz_elem(), pt_db_value_initialize(), and cubload::to_db_datetimeltz().

Here is the caller graph for this function:

int db_string_to_datetimeltz_ex ( const char *  str,
int  str_len,
DB_DATETIME datetime 
)

Definition at line 4533 of file db_date.c.

References db_datetimetz::datetime, db_string_to_datetimetz_ex(), error(), and NO_ERROR.

Referenced by db_string_to_datetimeltz().

Here is the caller graph for this function:

int db_string_to_datetimetz ( const char *  str,
DB_DATETIMETZ dt_tz,
bool has_zone 
)

Definition at line 4520 of file db_date.c.

References db_string_to_datetimetz_ex(), and strlen.

Referenced by ldr_check_date_time_conversion(), ldr_datetimetz_elem(), pt_db_value_initialize(), and cubload::to_db_datetimetz().

Here is the caller graph for this function:

int db_string_to_time ( const char *  buf,
DB_TIME dbtime 
)

Definition at line 3739 of file db_date.c.

References db_string_to_time_ex(), and strlen.

Referenced by db_string_value(), jsp_unpack_time_value(), ldr_check_date_time_conversion(), ldr_time_elem(), pt_db_value_initialize(), and cubload::to_db_time().

Here is the caller graph for this function:

int db_string_to_time_ex ( const char *  buf,
int  buf_len,
DB_TIME dbtime 
)
int db_string_to_timestamp ( const char *  buf,
DB_TIMESTAMP utime 
)

Definition at line 3802 of file db_date.c.

References db_string_to_timestamp_ex(), and strlen.

Referenced by db_string_value(), jsp_unpack_timestamp_value(), ldr_check_date_time_conversion(), ldr_timestamp_elem(), and cubload::to_db_timestamp().

Here is the caller graph for this function:

int db_string_to_timestamp_ex ( const char *  buf,
int  buf_len,
DB_TIMESTAMP utime 
)
int db_string_to_timestampltz ( const char *  str,
DB_TIMESTAMP ts 
)

Definition at line 3936 of file db_date.c.

References db_string_to_timestampltz_ex(), and strlen.

Referenced by ldr_check_date_time_conversion(), ldr_timestampltz_elem(), pt_db_value_initialize(), and cubload::to_db_timestampltz().

Here is the caller graph for this function:

int db_string_to_timestampltz_ex ( const char *  str,
int  str_len,
DB_TIMESTAMP ts 
)

Definition at line 3908 of file db_date.c.

References ARG_FILE_LINE, db_string_to_timestamptz_ex(), ER_DATE_CONVERSION, er_set(), ER_WARNING_SEVERITY, error(), NO_ERROR, and db_timestamptz::timestamp.

Referenced by db_string_to_timestampltz().

Here is the caller graph for this function:

int db_string_to_timestamptz ( const char *  str,
DB_TIMESTAMPTZ ts_tz,
bool has_zone 
)

Definition at line 3894 of file db_date.c.

References db_string_to_timestamptz_ex(), and strlen.

Referenced by ldr_check_date_time_conversion(), ldr_timestamptz_elem(), pt_db_value_initialize(), and cubload::to_db_timestamptz().

Here is the caller graph for this function:

int db_string_to_timestamptz_ex ( const char *  str,
int  str_len,
DB_TIMESTAMPTZ ts_tz,
bool has_zone,
bool  is_cast 
)
int db_time_to_string ( char *  buf,
int  bufsize,
DB_TIME dbtime 
)
int db_timestamp_decode_w_reg ( const DB_TIMESTAMP utime,
const TZ_REGION tz_region,
DB_DATE date,
DB_TIME timeval 
)
int db_timestamp_encode ( DB_TIMESTAMP utime,
DB_DATE date,
DB_TIME timeval 
)

Definition at line 579 of file db_date.c.

References db_timestamp_encode_ses(), and NULL.

Referenced by db_unix_timestamp().

Here is the caller graph for this function:

int db_timestamp_encode_sys ( const DB_DATE date,
const DB_TIME timeval,
DB_TIMESTAMP utime,
TZ_ID dest_tz_id 
)

Definition at line 617 of file db_date.c.

References db_timestamp_encode_w_reg(), and tz_get_system_tz_region().

Referenced by do_evaluate_default_expr(), fetch_peek_arith(), pt_evaluate_db_value_expr(), and qexec_execute_insert().

Here is the caller graph for this function:

int db_timestamp_to_string ( char *  buf,
int  bufsize,
DB_TIMESTAMP utime 
)

Definition at line 4054 of file db_date.c.

References db_date_to_string(), db_time_to_string(), and db_timestamp_decode_ses().

Referenced by date_to_char(), db_value_get(), fprint_special_strings(), tp_value_cast_internal(), and valcnv_convert_data_to_string().

Here is the caller graph for this function:

int db_timestampltz_to_string ( char *  buf,
int  bufsize,
DB_TIMESTAMP utime 
)
int db_timestamptz_to_string ( char *  buf,
int  bufsize,
DB_TIMESTAMP utime,
const TZ_ID tz_id 
)
int db_tm_encode ( struct tm *  c_time_struct,
DB_DATE date,
DB_TIME timeval 
)

Definition at line 536 of file db_date.c.

References tm_encode().

Referenced by db_set_base_server_time(), and db_strftime().

Here is the caller graph for this function:

bool is_leap_year ( int  year)
void julian_decode ( int  jul,
int *  monthp,
int *  dayp,
int *  yearp,
int *  weekp 
)