![]() |
MobilityDB 1.3
|
#include "postgres.h"
#include <limits.h>
#include "utils/timestamp_def.h"
#include "utils/datetime.h"
#include "utils/date.h"
#include "utils/float.h"
#include "../../include/meos.h"
Data Structures | |
struct | DCHCacheEntry |
struct | FormatNode |
struct | KeySuffix |
struct | KeyWord |
struct | TmFromChar |
struct | TmToChar |
Macros | |
#define | A_D_STR "A.D." |
#define | a_d_STR "a.d." |
#define | A_M_STR "A.M." |
#define | a_m_STR "a.m." |
#define | AD_STR "AD" |
#define | ad_STR "ad" |
#define | ADJUST_YEAR(year, is_interval) ((is_interval) ? (year) : ((year) <= 0 ? -((year) - 1) : (year))) |
#define | AM_STR "AM" |
#define | am_STR "am" |
#define | B_C_STR "B.C." |
#define | b_c_STR "b.c." |
#define | BC_STR "BC" |
#define | bc_STR "bc" |
#define | CHECK_ERROR |
#define | CLOCK_12_HOUR 1 |
#define | CLOCK_24_HOUR 0 |
#define | DCH_CACHE_ENTRIES 20 |
#define | DCH_CACHE_OVERHEAD MAXALIGN(sizeof(bool) + sizeof(int)) |
#define | DCH_CACHE_SIZE ((2048 - DCH_CACHE_OVERHEAD) / (sizeof(FormatNode) + sizeof(char)) - 1) |
#define | DCH_DATED 0x01 |
#define | DCH_FLAG 0x1 /* DATE-TIME flag */ |
#define | DCH_MAX_ITEM_SIZ 12 /* max localized day name */ |
#define | DCH_S_FM 0x01 |
#define | DCH_S_SP 0x08 |
#define | DCH_S_TH 0x02 |
#define | DCH_S_th 0x04 |
#define | DCH_S_TM 0x10 |
#define | DCH_TIMED 0x02 |
#define | DCH_to_char_fsec(frac_fmt, frac_val) |
#define | DCH_ZONED 0x04 |
#define | DEFAULT_COLLATION_OID 100 |
#define | INVALID_FOR_INTERVAL |
#define | KeyWord_INDEX_FILTER(_c) ((_c) <= ' ' || (_c) >= '~' ? 0 : 1) |
#define | KeyWord_INDEX_SIZE ('~' - ' ') |
#define | MAX_MULTIBYTE_CHAR_LEN 4 |
#define | MAX_TZ_PARSE_LEN 7 |
#define | NODE_TYPE_ACTION 2 |
#define | NODE_TYPE_CHAR 3 |
#define | NODE_TYPE_END 1 |
#define | NODE_TYPE_SEPARATOR 4 |
#define | NODE_TYPE_SPACE 5 |
#define | NUM_FLAG 0x2 /* NUMBER flag */ |
#define | P_M_STR "P.M." |
#define | p_m_STR "p.m." |
#define | PM_STR "PM" |
#define | pm_STR "pm" |
#define | RETURN_ERROR(throw_error) |
#define | S_FM(_s) (((_s) & DCH_S_FM) ? 1 : 0) |
#define | S_SP(_s) (((_s) & DCH_S_SP) ? 1 : 0) |
#define | S_TH(_s) (((_s) & DCH_S_TH) ? 1 : 0) |
#define | S_th(_s) (((_s) & DCH_S_th) ? 1 : 0) |
#define | S_TH_TYPE(_s) (((_s) & DCH_S_TH) ? TH_UPPER : TH_LOWER) |
#define | S_THth(_s) ((((_s) & DCH_S_TH) || ((_s) & DCH_S_th)) ? 1 : 0) |
#define | S_TM(_s) (((_s) & DCH_S_TM) ? 1 : 0) |
#define | SKIP_THth(ptr, _suf) |
#define | STD_FLAG 0x4 /* STANDARD flag */ |
#define | SUFFTYPE_POSTFIX 2 |
#define | SUFFTYPE_PREFIX 1 |
#define | TH_LOWER 2 |
#define | TH_UPPER 1 |
#define | TM_SUFFIX_LEN 2 |
#define | tmtcFsec(_X) ((_X)->fsec) |
#define | tmtcTm(_X) (&(_X)->tm) |
#define | tmtcTzn(_X) ((_X)->tzn) |
#define | ZERO_tm(_X) |
#define | ZERO_tmfc(_X) memset(_X, 0, sizeof(TmFromChar)) |
#define | ZERO_tmtc(_X) |
Typedefs | |
typedef struct TmToChar | TmToChar |
Functions | |
static int | adjust_partial_year_to_2020 (int year) |
char * | asc_initcap (const char *buff, size_t nbytes) |
char * | asc_tolower (const char *buff, size_t nbytes) |
static char * | asc_tolower_z (const char *buff) |
char * | asc_toupper (const char *buff, size_t nbytes) |
static char * | asc_toupper_z (const char *buff) |
text * | cstring2text (const char *cstring) |
Convert a C string into a text. More... | |
static text * | datetime_to_char_body (TmToChar *tmtc, text *fmt, bool is_interval, Oid collid) |
static DCHCacheEntry * | DCH_cache_fetch (const char *str, bool std) |
static DCHCacheEntry * | DCH_cache_getnew (const char *str, bool std) |
static DCHCacheEntry * | DCH_cache_search (const char *str, bool std) |
static int | DCH_datetime_type (FormatNode *node, bool *have_error) |
static void | DCH_from_char (FormatNode *node, const char *in, TmFromChar *out, Oid collid, bool std, bool *have_error) |
static void | DCH_prevent_counter_overflow (void) |
static void | DCH_to_char (FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid collid) |
static void | do_to_timestamp (text *date_txt, text *fmt, Oid collid, bool std, struct pg_tm *tm, fsec_t *fsec, int *fprec, uint32 *flags, bool *have_error) |
static int | from_char_parse_int (int *dest, const char **src, FormatNode *node, bool *have_error) |
static int | from_char_parse_int_len (int *dest, const char **src, const int len, FormatNode *node, bool *have_error) |
static int | from_char_seq_search (int *dest, const char **src, const char *const *array, char **localized_array, Oid collid, FormatNode *node, bool *have_error) |
static void | from_char_set_int (int *dest, const int value, const FormatNode *node, bool *have_error) |
static void | from_char_set_mode (TmFromChar *tmfc, const FromCharDateMode mode, bool *have_error) |
static const char * | get_th (char *num, int type) |
static const KeyWord * | index_seq_search (const char *str, const KeyWord *kw, const int *index) |
static bool | is_next_separator (FormatNode *n) |
static bool | is_separator_char (const char *str) |
void | MEOSAdjustTimestampForTypmod (Timestamp *time, int32 typmod) |
static void | parse_format (FormatNode *node, const char *str, const KeyWord *kw, const KeySuffix *suf, const int *index, uint32 flags) |
text * | pg_interval_to_char (Interval *it, text *fmt) |
Output an interval as text. More... | |
text * | pg_timestamp_to_char (Timestamp dt, text *fmt) |
Output a timestamp as text. More... | |
text * | pg_timestamptz_to_char (TimestampTz dt, text *fmt) |
Output a timestamptz as text. More... | |
DateADT | pg_to_date (text *date_txt, text *fmt) |
Input a date from text. More... | |
TimestampTz | pg_to_timestamp (text *date_txt, text *fmt) |
Input a timestamp from date text. More... | |
char * | pnstrdup (const char *in, Size size) |
Return a copy of the string value. More... | |
bool | scanner_isspace (char ch) |
static int | seq_search_ascii (const char *name, const char *const *array, int *len) |
static int | seq_search_localized (const char *name, char **array, int *len, Oid collid) |
static char * | str_initcap_z (const char *buff, Oid collid) |
static char * | str_numth (char *dest, char *num, int type) |
static char * | str_tolower_z (const char *buff, Oid collid) |
static char * | str_toupper_z (const char *buff, Oid collid) |
static int | strspace_len (const char *str) |
static const KeySuffix * | suff_search (const char *str, const KeySuffix *suf, int type) |
char * | text2cstring (const text *textptr) |
Convert a text into a C string. More... | |
Variables | |
static const char *const | adbc_strings [] = {ad_STR, bc_STR, AD_STR, BC_STR, NULL} |
static const char *const | adbc_strings_long [] = {a_d_STR, b_c_STR, A_D_STR, B_C_STR, NULL} |
static const char *const | ampm_strings [] = {am_STR, pm_STR, AM_STR, PM_STR, NULL} |
static const char *const | ampm_strings_long [] = {a_m_STR, p_m_STR, A_M_STR, P_M_STR, NULL} |
static const char *const | days_short [] |
static const int | DCH_index [KeyWord_INDEX_SIZE] |
static const KeyWord | DCH_keywords [] |
static const KeySuffix | DCH_suff [] |
static DCHCacheEntry * | DCHCache [DCH_CACHE_ENTRIES] |
static int | DCHCounter = 0 |
static const char *const | months_full [] |
static int | n_DCHCache = 0 |
static const char *const | numTH [] = {"ST", "ND", "RD", "TH", NULL} |
static const char *const | numth [] = {"st", "nd", "rd", "th", NULL} |
static const char *const | rm1 [] = {"I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", NULL} |
static const char *const | rm10 [] = {"X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC", NULL} |
static const char *const | rm100 [] = {"C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM", NULL} |
static const char *const | rm_months_lower [] |
static const char *const | rm_months_upper [] |