PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include <time.h>
#include <math.h>
#include <limits.h>
#include "common/string.h"
#include "dt.h"
#include "pgtypes_error.h"
#include "pgtypes_interval.h"
#include "pgtypeslib_extern.h"
Go to the source code of this file.
Functions | |
static void | AdjustFractSeconds (double frac, struct tm *tm, fsec_t *fsec, int scale) |
static void | AdjustFractDays (double frac, struct tm *tm, fsec_t *fsec, int scale) |
static int | ParseISO8601Number (const char *str, char **endptr, int *ipart, double *fpart) |
static int | ISO8601IntegerWidth (const char *fieldstart) |
static void | ClearPgTm (struct tm *tm, fsec_t *fsec) |
static int | DecodeISO8601Interval (char *str, int *dtype, struct tm *tm, fsec_t *fsec) |
int | DecodeInterval (char **field, int *ftype, int nf, int *dtype, struct tm *tm, fsec_t *fsec) |
static char * | AddVerboseIntPart (char *cp, int value, const char *units, bool *is_zero, bool *is_before) |
static char * | AddPostgresIntPart (char *cp, int value, const char *units, bool *is_zero, bool *is_before) |
static char * | AddISO8601IntPart (char *cp, int value, char units) |
static void | AppendSeconds (char *cp, int sec, fsec_t fsec, int precision, bool fillzeros) |
void | EncodeInterval (struct tm *tm, fsec_t fsec, int style, char *str) |
static int | interval2tm (interval span, struct tm *tm, fsec_t *fsec) |
static int | tm2interval (struct tm *tm, fsec_t fsec, interval *span) |
interval * | PGTYPESinterval_new (void) |
void | PGTYPESinterval_free (interval *intvl) |
interval * | PGTYPESinterval_from_asc (char *str, char **endptr) |
char * | PGTYPESinterval_to_asc (interval *span) |
int | PGTYPESinterval_copy (interval *intvlsrc, interval *intvldest) |
|
static |
Definition at line 723 of file interval.c.
References sprintf, and value.
Referenced by EncodeInterval().
|
static |
Definition at line 700 of file interval.c.
References sprintf, and value.
Referenced by EncodeInterval().
|
static |
Definition at line 680 of file interval.c.
References sprintf, and value.
Referenced by EncodeInterval().
Definition at line 41 of file interval.c.
References AdjustFractSeconds(), scale, SECS_PER_DAY, tm, and pg_tm::tm_mday.
Referenced by DecodeInterval(), and DecodeISO8601Interval().
Definition at line 23 of file interval.c.
References scale, tm, and pg_tm::tm_sec.
Referenced by AdjustFractDays(), DecodeInterval(), and DecodeISO8601Interval().
|
static |
Definition at line 733 of file interval.c.
References sprintf, and TrimTrailingZeros().
Referenced by EncodeInterval().
Definition at line 94 of file interval.c.
References tm, pg_tm::tm_hour, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, and pg_tm::tm_year.
Referenced by DecodeInterval(), and DecodeISO8601Interval().
int DecodeInterval | ( | char ** | field, |
int * | ftype, | ||
int | nf, | ||
int * | dtype, | ||
struct tm * | tm, | ||
fsec_t * | fsec | ||
) |
Definition at line 326 of file interval.c.
References AdjustFractDays(), AdjustFractSeconds(), AGO, Assert, ClearPgTm(), DAY, DAYS_PER_MONTH, DecodeTime(), DecodeUnits(), DTERR_BAD_FORMAT, DTERR_FIELD_OVERFLOW, DTK_ALL_SECS_M, DTK_CENTURY, DTK_DATE, DTK_DATE_M, DTK_DAY, DTK_DECADE, DTK_DELTA, DTK_HOUR, DTK_M, DTK_MICROSEC, DTK_MILLENNIUM, DTK_MILLISEC, DTK_MINUTE, DTK_MONTH, DTK_NUMBER, DTK_SECOND, DTK_SPECIAL, DTK_STRING, DTK_TIME, DTK_TIME_M, DTK_TZ, DTK_WEEK, DTK_YEAR, HOUR, i, IGNORE_DTF, INTERVAL_FULL_RANGE, INTERVAL_MASK, IntervalStyle, INTSTYLE_POSTGRES_VERBOSE, INTSTYLE_SQL_STANDARD, MICROSECOND, MILLISECOND, MINUTE, MONTH, MONTHS_PER_YEAR, range(), RESERV, SECOND, SECS_PER_DAY, SECS_PER_HOUR, SECS_PER_MINUTE, strtoint(), tm, pg_tm::tm_hour, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, pg_tm::tm_year, type, TZ, UNITS, USECS_PER_SEC, val, and YEAR.
Referenced by PGTYPESinterval_from_asc().
Definition at line 112 of file interval.c.
References AdjustFractDays(), AdjustFractSeconds(), ClearPgTm(), DAYS_PER_MONTH, DTERR_BAD_FORMAT, DTK_DELTA, ISO8601IntegerWidth(), MONTHS_PER_YEAR, ParseISO8601Number(), SECS_PER_DAY, SECS_PER_HOUR, SECS_PER_MINUTE, str, tm, pg_tm::tm_hour, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, pg_tm::tm_year, and val.
Referenced by PGTYPESinterval_from_asc().
Definition at line 759 of file interval.c.
References AddISO8601IntPart(), AddPostgresIntPart(), AddVerboseIntPart(), AppendSeconds(), INTSTYLE_ISO_8601, INTSTYLE_POSTGRES, INTSTYLE_POSTGRES_VERBOSE, INTSTYLE_SQL_STANDARD, MAX_INTERVAL_PRECISION, sprintf, str, tm, pg_tm::tm_hour, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, and pg_tm::tm_year.
Referenced by PGTYPESinterval_to_asc().
Definition at line 942 of file interval.c.
References interval::month, MONTHS_PER_YEAR, interval::time, tm, pg_tm::tm_hour, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, pg_tm::tm_year, USECS_PER_DAY, USECS_PER_HOUR, USECS_PER_MINUTE, and USECS_PER_SEC.
Referenced by PGTYPESinterval_to_asc().
|
static |
|
static |
Definition at line 56 of file interval.c.
References DTERR_BAD_FORMAT, DTERR_FIELD_OVERFLOW, str, and val.
Referenced by DecodeISO8601Interval().
Definition at line 1082 of file interval.c.
References interval::month, and interval::time.
Referenced by ecpg_get_data(), and main().
void PGTYPESinterval_free | ( | interval * | intvl | ) |
interval* PGTYPESinterval_from_asc | ( | char * | str, |
char ** | endptr | ||
) |
Definition at line 1003 of file interval.c.
References DecodeInterval(), DecodeISO8601Interval(), DTK_DELTA, free, MAXDATEFIELDS, MAXDATELEN, ParseDateTime(), pgtypes_alloc(), PGTYPES_INTVL_BAD_INTERVAL, str, tm, tm2interval(), pg_tm::tm_hour, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, and pg_tm::tm_year.
Referenced by ecpg_get_data(), and main().
interval* PGTYPESinterval_new | ( | void | ) |
char* PGTYPESinterval_to_asc | ( | interval * | span | ) |
Definition at line 1062 of file interval.c.
References buf, EncodeInterval(), interval2tm(), IntervalStyle, INTSTYLE_POSTGRES_VERBOSE, MAXDATELEN, PGTYPES_INTVL_BAD_INTERVAL, pgtypes_strdup(), and tm.
Referenced by ecpg_store_input(), intoasc(), and main().
Definition at line 972 of file interval.c.
References interval::month, MONTHS_PER_YEAR, interval::time, tm, pg_tm::tm_hour, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, pg_tm::tm_year, and USECS_PER_SEC.
Referenced by PGTYPESinterval_from_asc().