Skip to content

Commit 7c5a561

Browse files
author
Michael Meskes
committed
Applied patch by Ron Mayer <rm_pg@cheapcomplexdevices.com> to merge the new
interval style into ecpg.
1 parent cbb3e1c commit 7c5a561

File tree

6 files changed

+791
-376
lines changed

6 files changed

+791
-376
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2394,6 +2394,8 @@ Sat, 25 Oct 2008 16:34:28 +0200
23942394
Wed, 26 Nov 2008 14:09:08 +0100
23952395

23962396
- When creating a varchar struct name braces must be discarded.
2397+
- Applied patch by Ron Mayer <rm_pg@cheapcomplexdevices.com> to merge
2398+
the new interval style into ecpg.
23972399
- Set pgtypes library version to 3.1.
23982400
- Set compat library version to 3.1.
23992401
- Set ecpg library version to 6.2.

src/interfaces/ecpg/pgtypeslib/dt.h

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt.h,v 1.39 2007/11/15 21:14:45 momjian Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt.h,v 1.40 2008/11/26 16:31:02 meskes Exp $ */
22

33
#ifndef DT_H
44
#define DT_H
@@ -25,6 +25,22 @@ typedef double fsec_t;
2525
#define USE_SQL_DATES 2
2626
#define USE_GERMAN_DATES 3
2727

28+
#define INTSTYLE_POSTGRES 0
29+
#define INTSTYLE_POSTGRES_VERBOSE 1
30+
#define INTSTYLE_SQL_STANDARD 2
31+
#define INTSTYLE_ISO_8601 3
32+
33+
#define INTERVAL_FULL_RANGE (0x7FFF)
34+
#define INTERVAL_MASK(b) (1 << (b))
35+
#define MAX_INTERVAL_PRECISION 6
36+
37+
#define DTERR_BAD_FORMAT (-1)
38+
#define DTERR_FIELD_OVERFLOW (-2)
39+
#define DTERR_MD_FIELD_OVERFLOW (-3) /* triggers hint about DateStyle */
40+
#define DTERR_INTERVAL_OVERFLOW (-4)
41+
#define DTERR_TZDISP_OVERFLOW (-5)
42+
43+
2844
#define DAGO "ago"
2945
#define EPOCH "epoch"
3046
#define INVALID "invalid"
@@ -77,6 +93,9 @@ typedef double fsec_t;
7793
* Furthermore, the values for YEAR, MONTH, DAY, HOUR, MINUTE, SECOND
7894
* must be in the range 0..14 so that the associated bitmasks can fit
7995
* into the left half of an INTERVAL's typmod value.
96+
*
97+
* Copy&pasted these values from src/include/utils/datetime.h
98+
* 2008-11-20, changing a number of their values.
8099
*/
81100

82101
#define RESERV 0
@@ -92,20 +111,23 @@ typedef double fsec_t;
92111
#define HOUR 10
93112
#define MINUTE 11
94113
#define SECOND 12
95-
#define DOY 13
96-
#define DOW 14
97-
#define UNITS 15
98-
#define ADBC 16
114+
#define MILLISECOND 13
115+
#define MICROSECOND 14
116+
#define DOY 15
117+
#define DOW 16
118+
#define UNITS 17
119+
#define ADBC 18
99120
/* these are only for relative dates */
100-
#define AGO 17
101-
#define ABS_BEFORE 18
102-
#define ABS_AFTER 19
121+
#define AGO 19
122+
#define ABS_BEFORE 20
123+
#define ABS_AFTER 21
103124
/* generic fields to help with parsing */
104-
#define ISODATE 20
105-
#define ISOTIME 21
125+
#define ISODATE 22
126+
#define ISOTIME 23
106127
/* reserved for unrecognized string values */
107128
#define UNKNOWN_FIELD 31
108129

130+
109131
/*
110132
* Token field definitions for time parsing and decoding.
111133
* These need to fit into the datetkn table type.
@@ -164,13 +186,13 @@ typedef double fsec_t;
164186
/*
165187
* Bit mask definitions for time parsing.
166188
*/
167-
189+
/* Copy&pasted these values from src/include/utils/datetime.h */
168190
#define DTK_M(t) (0x01 << (t))
169-
191+
#define DTK_ALL_SECS_M (DTK_M(SECOND) | DTK_M(MILLISECOND) | DTK_M(MICROSECOND))
170192
#define DTK_DATE_M (DTK_M(YEAR) | DTK_M(MONTH) | DTK_M(DAY))
171193
#define DTK_TIME_M (DTK_M(HOUR) | DTK_M(MINUTE) | DTK_M(SECOND))
172194

173-
#define MAXDATELEN 51 /* maximum possible length of an input date
195+
#define MAXDATELEN 63 /* maximum possible length of an input date
174196
* string (not counting tr. null) */
175197
#define MAXDATEFIELDS 25 /* maximum possible number of fields in a date
176198
* string */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy