# 36.6. pgtypes Library
36.6.7. errno Values of pgtypeslib
36.6.8. Special Constants of pgtypeslib
The pgtypes library maps PostgreSQL database types to C equivalents that can be used in C programs. It also offers functions to do basic calculations with those types within C, i.e., without the help of the PostgreSQL server. See the following example:
EXEC SQL BEGIN DECLARE SECTION;
date date1;
timestamp ts1, tsout;
interval iv1;
char *out;
EXEC SQL END DECLARE SECTION;
PGTYPESdate_today(&date1);
EXEC SQL SELECT started, duration INTO :ts1, :iv1 FROM datetbl WHERE d=:date1;
PGTYPEStimestamp_add_interval(&ts1, &iv1, &tsout);
out = PGTYPEStimestamp_to_asc(&tsout);
printf("Started + duration: %s\n", out);
PGTYPESchar_free(out);
# 36.6.1. Character Strings
Some functions such asPGTYPESnumeric_to_asc
return a pointer to a freshly allocated character string. These results should be freed withPGTYPESchar_free
instead offree
. (This is important only on Windows, where memory allocation and release sometimes need to be done by the same library.)
# 36.6.2. The numeric Type
The numeric type offers to do calculations with arbitrary precision. SeeSection 8.1for the equivalent type in the PostgreSQL server. Because of the arbitrary precision this variable needs to be able to expand and shrink dynamically. That's why you can only create numeric variables on the heap, by means of thePGTYPESnumeric_new
andPGTYPESnumeric_free
functions. The decimal type, which is similar but limited in precision, can be created on the stack as well as on the heap.
The following functions can be used to work with the numeric type:
PGTYPESnumeric_new
Request a pointer to a newly allocated numeric variable.
numeric *PGTYPESnumeric_new(void);
PGTYPESnumeric_free
释放一个数字类型,释放其所有内存。
void PGTYPESnumeric_free(numeric *var);
PGTYPESnumeric_from_asc
从其字符串表示法解析数字类型。
numeric *PGTYPESnumeric_from_asc(char *str, char **endptr);
有效格式例如:-2
,.794
,+3.44
,592.49E07
要么-32.84e-4
.如果可以成功解析该值,则返回一个有效指针,否则返回 NULL 指针。目前 ECPG 总是解析完整的字符串,因此目前不支持将第一个无效字符的地址存储在*endptr
.您可以安全地设置结束点
为空。
PGTYPESnumeric_to_asc
返回指向由分配的字符串的指针malloc
包含数字类型的字符串表示数
.
char *PGTYPESnumeric_to_asc(numeric *num, int dscale);
数值将打印为缩放
十进制数字,必要时进行四舍五入。结果必须被释放PGTYPESchar_free()
.
PGTYPESnumeric_add
将两个数值变量添加到第三个变量中。
int PGTYPESnumeric_add(numeric *var1, numeric *var2, numeric *result);
函数添加变量变量1
和变量2
进入结果变量结果
.该函数在成功时返回 0,在出错时返回 -1.
PGTYPESnumeric_sub
减去两个数值变量并在第三个变量中返回结果。
int PGTYPESnumeric_sub(numeric *var1, numeric *var2, numeric *result);
函数减去变量变量2
从变量变量1
.运算结果存储在变量中结果
.该函数在成功时返回 0,在出错时返回 -1.
PGTYPESnumeric_mul
将两个数值变量相乘并在第三个变量中返回结果。
int PGTYPESnumeric_mul(numeric *var1, numeric *var2, numeric *result);
该函数将变量相乘变量1
和变量2
.运算结果存储在变量中结果
.该函数在成功时返回 0,在出错时返回 -1.
PGTYPESnumeric_div
将两个数值变量相除并在第三个变量中返回结果。
int PGTYPESnumeric_div(numeric *var1, numeric *var2, numeric *result);
函数除变量变量1
经过变量2
.运算结果存储在变量中结果
.该函数在成功时返回 0,在出错时返回 -1.
PGTYPESnumeric_cmp
比较两个数值变量。
int PGTYPESnumeric_cmp(numeric *var1, numeric *var2)
此函数比较两个数值变量。万一出错,INT_MAX
被退回。成功时,该函数返回三个可能的结果之一:
1,如果
变量1
大于变量2
-1,如果
变量1
小于变量2
0,如果
变量1
和变量2
相等
PGTYPESnumeric_from_int
将 int 变量转换为数值变量。
int PGTYPESnumeric_from_int(signed int int_val, numeric *var);
此函数接受带符号的 int 类型的变量并将其存储在数值变量中变量
.成功时返回 0,失败时返回 -1.
PGTYPESnumeric_from_long
将 long int 变量转换为数值变量。
int PGTYPESnumeric_from_long(signed long int long_val, numeric *var);
该函数接受一个有符号长整数类型的变量并将其存储在数值变量中变量
.成功时返回 0,失败时返回 -1.
PGTYPESnumeric_copy
将一个数值变量复制到另一个变量中。
int PGTYPESnumeric_copy(numeric *src, numeric *dst);
此函数复制变量的值源代码
指向变量夏令时
指着。成功时返回 0,发生错误时返回 -1.
PGTYPESnumeric_from_double
将 double 类型的变量转换为数值。
int PGTYPESnumeric_from_double(double d, numeric *dst);
该函数接受一个 double 类型的变量并将结果存储在夏令时
指着。成功时返回 0,发生错误时返回 -1.
PGTYPESnumeric_to_double
将数字类型的变量转换为双精度。
int PGTYPESnumeric_to_double(numeric *nv, double *dp)
该函数将数值从变量转换为nv
指向双变量dp
指着。成功时返回 0,如果发生错误(包括溢出)则返回 -1.溢出时,全局变量错误号
将设置为PGTYPES_NUM_OVERFLOW
此外。
PGTYPESnumeric_to_int
将 numeric 类型的变量转换为 int。
int PGTYPESnumeric_to_int(numeric *nv, int *ip);
该函数将数值从变量转换为nv
指向整数变量ip
指着。成功时返回 0,如果发生错误(包括溢出)则返回 -1.溢出时,全局变量错误号
将设置为PGTYPES_NUM_OVERFLOW
此外。
PGTYPESnumeric_to_long
将数值类型的变量转换为长整型。
int PGTYPESnumeric_to_long(numeric *nv, long *lp);
该函数将数值从变量转换为nv
指向长整型变量lp
指着。成功时返回 0,如果发生错误(包括溢出)则返回 -1.溢出时,全局变量错误号
将设置为PGTYPES_NUM_OVERFLOW
此外。
PGTYPESnumeric_to_decimal
将数字类型的变量转换为十进制。
int PGTYPESnumeric_to_decimal(numeric *src, decimal *dst);
该函数将数值从变量转换为源代码
指向十进制变量夏令时
指着。成功时返回 0,如果发生错误(包括溢出)则返回 -1.溢出时,全局变量错误号
将设置为PGTYPES_NUM_OVERFLOW
此外。
PGTypesUnmeric_from_decimal
将十进制类型的变量转换为数字。
int PGTYPESnumeric_from_decimal(decimal *src, numeric *dst);
该函数用于转换变量的十进制值src
指向dst
指向。成功时返回0,发生错误时返回-1.由于decimal类型是作为数值类型的有限版本实现的,因此此转换不会发生溢出。
# 36.6.3.日期类型
C中的日期类型使程序能够处理SQL类型的日期数据。看见第8.5节用于PostgreSQL server中的等效类型。
以下函数可用于处理日期类型:
PGTYPESdate_from_时间戳
从时间戳中提取日期部分。
date PGTYPESdate_from_timestamp(timestamp dt);
函数接收一个时间戳作为其唯一的参数,并从该时间戳返回提取的日期部分。
PGTYPESdate_来自asc
从文本表示中解析日期。
date PGTYPESdate_from_asc(char *str, char **endptr);
该函数接收一个C字符*一串str
以及指向C字符的指针*一串endptr
。目前,ECPG总是解析完整的字符串,因此它目前不支持将第一个无效字符的地址存储在*endptr
.你可以安全设置endptr
为空。
请注意,该函数始终假定MDY格式的日期,并且在ECPG中当前没有变量可以更改该日期。
表36.2显示允许的输入格式。
表36.2.有效的输入格式PGTYPESdate_来自asc
输入 | 后果 |
---|---|
1999年1月8日 | 1999年1月8日 |
1999-01-08 | 1999年1月8日 |
1/8/1999 | 1999年1月8日 |
1/18/1999 | 1999年1月18日 |
01/02/03 | 2003年2月1日 |
1999-1-08 | 1999年1月8日 |
1999年1月8日 | 1999年1月8日 |
08-Jan-1999 | 1999年1月8日 |
99-01-08 | 1999年1月8日 |
1999年1月8日 | 1999年1月8日 |
08-01-06 | 2006年1月8日 |
1999年1月8日 | 1999年1月8日 |
19990108 | ISO 8601;1999年1月8日 |
990108 | ISO 8601;1999年1月8日 |
1999.008 | 年复一日 |
J2451187 | 朱利安日 |
公元前99年1月8日 | 普通时代前99年 |
PGTYPESdate_至_asc
返回日期变量的文本表示形式。
char *PGTYPESdate_to_asc(date dDate);
函数接收日期达特
作为它唯一的参数。它将在表单中输出日期1999-01-18
,即在YYYY-MM-DD
总体安排结果必须用PGTYPESchar_free()
.
PGTYPESdate_julmdy
从日期类型的变量中提取日期、月份和年份的值。
void PGTYPESdate_julmdy(date d, int *mdy);
函数接收日期d
以及指向3个整数值数组的指针麦迪
.变量名表示顺序:mdy[0]
将设置为包含月份的编号,mdy[1]
将设置为当天的值mdy[2]
将包含全年。
PGTYPESdate_mdyjul
从指定日期的日期、月份和年份的3个整数数组中创建日期值。
void PGTYPESdate_mdyjul(int *mdy, date *jdate);
函数接收3个整数的数组(麦迪
)作为它的第一个参数和第二个参数,一个指向date类型的变量的指针,该变量应该保存操作的结果。
PGTYPESdate_dayofweek
为日期值返回一个代表一周中某一天的数字。
int PGTYPESdate_dayofweek(date d);
函数接收日期变量d
作为其唯一参数,并返回一个整数,该整数指示该日期的星期几。
0-周日
1-星期一
2-星期二
3-星期三
4-周四
5-周五
6-周六
今天是你的生日
获取当前日期。
void PGTYPESdate_today(date *d);
函数接收指向日期变量的指针(d
)将其设置为当前日期。
PGTYPESdate_fmt_asc
使用格式掩码将日期类型的变量转换为其文本表示形式。
int PGTYPESdate_fmt_asc(date dDate, char *fmtstring, char *outbuf);
函数接收要转换的日期(达特
),格式掩码(fmtstring
)以及保存日期文本表示形式的字符串(爆发
).
成功时,将返回0,如果发生错误,则返回负值。
以下文字是可以使用的字段说明符:
dd
-一个月中某一天的数字。嗯
-一年中月份的编号。yy
-一年中的数字为两位数。年份
-以四位数表示的年份编号。ddd
-一天的名字(缩写)。嗯
-月份的名称(缩写)。所有其他字符以1:1的比例复制到输出字符串中。
表36.3表示几种可能的格式。这将让你了解如何使用这个功能。所有输出行均基于同一日期:1959年11月23日。
表36.3.有效的输入格式PGTYPESdate_fmt_asc
总体安排 | 后果 |
---|---|
嗯 | 112359 |
ddmmyy | 231159 |
yymmdd | 591123 |
yy/mm/dd | 59/11/23 |
yy mm dd | 59 11 23 |
yy.mm.dd | 59.11.23 |
.mm.yyyy.dd. | .11.1959.23. |
mmm. dd, yyyy | Nov. 23, 1959 |
mmm dd yyyy | Nov 23 1959 |
yyyy dd mm | 1959 23 11 |
ddd, mmm. dd, yyyy | Mon, Nov. 23, 1959 |
(ddd) mmm. dd, yyyy | (Mon) Nov. 23, 1959 |
PGTYPESdate_defmt_asc
Use a format mask to convert a Cchar*
string to a value of type date.
int PGTYPESdate_defmt_asc(date *d, char *fmt, char *str);
The function receives a pointer to the date value that should hold the result of the operation (d
), the format mask to use for parsing the date (fmt
) and the C char*包含日期文本表示形式的字符串(str
).文本表示形式应与格式掩码匹配。但是,不需要将字符串与格式掩码进行1:1映射。该函数只分析顺序并查找文字yy
或年份
这表明了今年的形势,嗯
表示月份的位置,以及dd
指示当天的位置。
表36.4表示几种可能的格式。这将让你了解如何使用这个功能。
表36.4.有效的输入格式rdefmtdate
总体安排 | 一串 | 后果 |
---|---|---|
ddmmyy | 21-2-54 | 1954-02-21 |
ddmmyy | 2-12-54 | 1954-12-02 |
ddmmyy | 20111954 | 1954-11-20 |
ddmmyy | 130464 | 1964-04-13 |
mmm.dd.yyyy | MAR-12-1967 | 1967-03-12 |
yy/mm/dd | 1954, February 3rd | 1954-02-03 |
mmm.dd.yyyy | 041269 | 1969-04-12 |
yy/mm/dd | In the year 2525, in the month of July, mankind will be alive on the 28th day | 2525-07-28 |
dd-mm-yy | I said on the 28th of July in the year 2525 | 2525-07-28 |
mmm.dd.yyyy | 9/14/58 | 1958-09-14 |
yy/mm/dd | 47/03/29 | 1947-03-29 |
mmm.dd.yyyy | oct 28 1975 | 1975-10-28 |
mmddyy | Nov 14th, 1985 | 1985-11-14 |
# 36.6.4. The timestamp Type
The timestamp type in C enables your programs to deal with data of the SQL type timestamp. See第8.5节用于PostgreSQL server中的等效类型。
以下函数可用于处理时间戳类型:
PGTYPEStimestamp_来自asc
将时间戳从其文本表示形式解析为时间戳变量。
timestamp PGTYPEStimestamp_from_asc(char *str, char **endptr);
函数接收要分析的字符串(str
)以及指向C字符的指针* (endptr
)。目前,ECPG总是解析完整的字符串,因此它目前不支持将第一个无效字符的地址存储在*endptr
.你可以安全设置endptr
为空。
函数在成功时返回解析的时间戳。一旦出错,PGTYPESInvalidTimestamp
返回并呃不
即将PGTYPES_TS_BAD_时间戳
看见PGTYPESInvalidTimestamp
有关此值的重要说明。
通常,输入字符串可以包含允许的日期规范、空白字符和允许的时间规范的任意组合。请注意,ECPG不支持时区。它可以解析它们,但不会像PostgreSQL server那样应用任何计算。时区说明符被悄悄地丢弃。
表36.5包含几个输入字符串的示例。
表36.5.有效的输入格式PGTYPEStimestamp_来自asc
输入 | 后果 |
---|---|
1999-01-08 04:05:06 | 1999-01-08 04:05:06 |
太平洋标准时间1999年1月8日04:05:06 | 1999-01-08 04:05:06 |
1999年1月8日04:05:06.789-8 | 1999-01-08 04:05:06.789(忽略时区说明符) |
J2451187 04:05-08:00 | 1999-01-08 04:05:00(忽略时区说明符) |
PGTYPEStimestamp_至_asc
将日期转换为C字符*一串
char *PGTYPEStimestamp_to_asc(timestamp tstamp);
函数接收时间戳坦普
并返回一个已分配的字符串,该字符串包含时间戳的文本表示形式。结果必须用PGTYPESchar_free()
.
PGTYPEStimestamp_电流
检索当前时间戳。
void PGTYPEStimestamp_current(timestamp *ts);
函数检索当前时间戳并将其保存到ts
指向。
PGTYPEStimestamp_fmt_asc
将时间戳变量转换为C字符*使用格式掩码。
int PGTYPEStimestamp_fmt_asc(timestamp *ts, char *output, int str_len, char *fmtstr);
函数接收指向要转换的时间戳的指针作为其第一个参数(ts
),指向输出缓冲区的指针(输出
),为输出缓冲区分配的最大长度(斯特鲁伦
)以及用于转换的格式掩码(fmtstr
).
成功后,如果发生错误,函数将返回0和负值。
您可以对格式掩码使用以下格式说明符。格式说明符与strftime
函数在libc中。任何非格式说明符都将被复制到输出缓冲区。
%A
-由工作日全名的国家代表性替换。%a
-由缩写的工作日名称的国家代表代替。%B
-由全国代表性的月份全名代替。%b
-替换为缩写月份名称的国家代表。%C
-被(年份/100)替换为十进制数;一位数前加一个零。%c
-由时间和日期的国家代表代替。%D
-相当于%m/%d/%y
.%d
-以十进制数字(01–31)的形式替换为月份的日期。%E*
%O*
-POSIX本地扩展。序列%欧共体
%欧共体
%前任
%前任
%嗯
%嗯
%来自
%Oe
%哦
%哎
%嗯
%嗯
%操作系统
%欧
%欧
%奥夫
%哦
%哦
%哦
都应该提供其他的表述。另外
%OB
实现用于表示替代月份名称(单独使用,未提及日期)。%e
-被月日替换为十进制数(1-31);单个数字前面有一个空格。%F
-相当于%Y-%m-%d
.%G
-被一年替换为带世纪的十进制数字。今年是一周中大部分时间的一年(周一是一周的第一天)。%g
-替换为中的同一年%G
,但作为不带世纪的十进制数(00–99)。%H
-被小时(24小时时钟)替换为十进制数字(00–23)。%h
-和%b
.%我
-被小时(12小时时钟)替换为十进制数字(01–12)。%j
-被一年中的某一天替换为十进制数(001–366)。%k
-被小时(24小时时钟)替换为十进制数字(0-23);单个数字前面有一个空格。%l
-被小时(12小时时钟)替换为十进制数字(1-12);单个数字前面有一个空格。%M
-被分钟替换为十进制数字(00–59)。%m
-被月份替换为十进制数字(01–12)。%n
-被一条新线取代。%O*
-和%E*
.%p
-由“前梅里迪姆”或“后梅里迪姆”的国家代表(视情况而定)取代。%R
-相当于%H:%M
.%r
-相当于%I:%M:%S%p
.%S
-替换为第二个十进制数(00–60)。%s
-替换为自纪元UTC起的秒数。%T
-相当于%H:%M:%S
%t
-替换为选项卡。%U
-被一年中的周数(星期日为一周的第一天)替换为十进制数(00–53)。%u
-被工作日(周一为一周的第一天)替换为十进制数字(1-7)。%五
-被一年中的周数(星期一为一周的第一天)替换为十进制数(01–53)。如果包含1月1日的一周在新的一年中有四天或更多天,则为第1周;否则这是上一年的最后一周,下一周是第1周。%五
-相当于%e-%b-%Y
.%W
-被一年中的周数(星期一为一周的第一天)替换为十进制数(00–53)。%w
-被工作日(星期日为一周的第一天)替换为十进制数(0–6)。%X
-被当时的国家代表所取代。%x
-替换为日期的国家代表。%Y
-替换为以世纪为十进制数的年份。%y
-被无世纪的年份替换为十进制数(00–99)。%Z
-将替换为时区名称。%z
-替换为UTC的时区偏移量;前面的加号代表UTC以东,减号代表UTC以西,小时和分钟后面各有两个数字,中间没有分隔符(通用格式为RFC 822 (opens new window)日期标题)。%+
-替换为日期和时间的国家代表。%-*
-GNU libc扩展。执行数字输出时,不要进行任何填充。$_*-GNU libc扩展。显式指定填充空间。
%0*
-GNU libc扩展。为填充显式指定零。%%
-被替换为%
.
PGTYPEStimestamp_sub
从另一个时间戳中减去一个时间戳,并将结果保存在interval类型的变量中。
int PGTYPEStimestamp_sub(timestamp *ts1, timestamp *ts2, interval *iv);
该函数将减去ts2
从timestamp变量中指向ts1
指向并将结果存储在四、
指向。
成功后,如果发生错误,函数将返回0和负值。
PGTYPEStimestamp_defmt_asc
使用格式掩码从文本表示中解析时间戳值。
int PGTYPEStimestamp_defmt_asc(char *str, char *fmt, timestamp *d);
函数接收变量中时间戳的文本表示str
以及在变量中使用的格式掩码fmt
。结果将存储在d
指向。
如果格式化掩码fmt
如果为空,函数将返回默认的格式掩码,即%Y-%m-%d%H:%m:%S
.
这是与之相反的功能PGTYPEStimestamp_fmt_asc
。请参阅此处的文档,以了解可能的格式掩码条目。
PGTYPEStimestamp_添加_间隔
将间隔变量添加到时间戳变量。
int PGTYPEStimestamp_add_interval(timestamp *tin, interval *span, timestamp *tout);
函数接收指向时间戳变量的指针锡
以及一个指向区间变量的指针跨度
。它将间隔添加到时间戳,并将生成的时间戳保存在吹牛
指向。
成功后,如果发生错误,函数将返回0和负值。
PGTYPEStimestamp_sub_间隔
从时间戳变量中减去间隔变量。
int PGTYPEStimestamp_sub_interval(timestamp *tin, interval *span, timestamp *tout);
该函数减去跨度
从timestamp变量中指向锡
指向并将结果保存到吹牛
指向。
成功后,如果发生错误,函数将返回0和负值。
# 36.6.5.区间型
C中的interval类型使程序能够处理SQL类型interval的数据。看见第8.5节用于PostgreSQL server中的等效类型。
以下功能可用于处理间隔类型:
PGTYPESinterval_new
返回指向新分配的间隔变量的指针。
interval *PGTYPESinterval_new(void);
PGTypesInTurval_free
释放之前分配的间隔变量的内存。
void PGTYPESinterval_free(interval *intvl);
PGTYPES从asc接收
从文本表示中解析一个区间。
interval *PGTYPESinterval_from_asc(char *str, char **endptr);
The function parses the input stringstr
and returns a pointer to an allocated interval variable. At the moment ECPG always parses the complete string and so it currently does not support to store the address of the first invalid character in*endptr
. You can safely setendptr
to NULL.
PGTYPESinterval_to_asc
Convert a variable of type interval to its textual representation.
char *PGTYPESinterval_to_asc(interval *span);
The function converts the interval variable thatspan
points to into a C char*. The output looks like this example:@ 1 day 12 hours 59 mins 10 secs
. The result must be freed withPGTYPESchar_free()
.
PGTYPESinterval_copy
Copy a variable of type interval.
int PGTYPESinterval_copy(interval *intvlsrc, interval *intvldest);
The function copies the interval variable thatintvlsrc
points to into the variable thatintvldest
points to. Note that you need to allocate the memory for the destination variable before.
# 36.6.6. The decimal Type
The decimal type is similar to the numeric type. However it is limited to a maximum precision of 30 significant digits. In contrast to the numeric type which can be created on the heap only, the decimal type can be created either on the stack or on the heap (by means of the functionsPGTYPESdecimal_new
andPGTYPESdecimal_free
)。在中描述的Informix兼容模式中,还有许多其他函数处理十进制类型第36.15节.
以下函数可用于处理decimal类型,并且不仅包含在利比卡特
图书馆
PGTYPES CIMAL_新
请求指向新分配的十进制变量的指针。
decimal *PGTYPESdecimal_new(void);
PGTypesCIMAL_免费
释放十进制类型,释放其所有内存。
void PGTYPESdecimal_free(decimal *var);
# 36.6.7.pgtypeslib的errno值
PGTYPES_NUM_BAD_NUMERIC
一个参数应该包含一个数值变量(或指向一个数值变量),但实际上它在内存中的表示是无效的。
PGTYPES_NUM_溢出
发生溢出。由于数值类型可以处理几乎任意的精度,因此将数值变量转换为其他类型可能会导致溢出。
PGTYPES_NUM_下溢
出现下溢。由于数值类型可以处理几乎任意的精度,因此将数值变量转换为其他类型可能会导致下溢。
PGTYPES_NUM_DIVIDE_ZERO
已尝试用零除。
PGTYPES_DATE_BAD_DATE
传递给服务器的日期字符串无效PGTYPESdate_来自asc
作用
PGTYPES_DATE_ERR_EARGS
已将无效参数传递给PGTYPESdate_defmt_asc
作用
PGTYPES_DATE_ERR_ENOSHORTDATE
服务器在输入字符串中找到无效令牌PGTYPESdate_defmt_asc
作用
PGTYPES_INTVL_BAD_间隔
传递给服务器的间隔字符串无效PGTYPES从asc接收
函数,或向PGTYPESinterval_to_asc
作用
PGTYPES_DATE_ERR_ENOTDMY
项目中的日/月/年分配不匹配PGTYPESdate_defmt_asc
作用
PGTYPES_DATE_BAD_DAY
用户发现一个无效的月天数值PGTYPESdate_defmt_asc
作用
PGTYPES_DATE_BAD_MONTH
用户发现一个无效的月份值PGTYPESdate_defmt_asc
作用
PGTYPES_TS_BAD_时间戳
传递给的时间戳字符串无效PGTYPEStimestamp_来自asc
函数,或将无效的时间戳值传递给PGTYPEStimestamp_至_asc
作用
PGTYPES_TS_ERR_EINFTIME
在无法处理的上下文中遇到无限时间戳值。
# 36.6.8.pgtypeslib的特殊常数
PGTYPESInvalidTimestamp
timestamp类型的值表示无效的时间戳。这是由函数返回的PGTYPEStimestamp_来自asc
解析错误。请注意,由于时间戳
数据类型,PGTYPESInvalidTimestamp
同时也是一个有效的时间戳。设定为1899-12-31 23:59:59
。为了检测错误,请确保您的应用程序不仅测试PGTYPESInvalidTimestamp
也是为了呃,不0
每次打电话给PGTYPEStimestamp_来自asc
.