返回首页

gbase数据、南大通用产品文档:GBase8a

更新日期:2024年09月11日

GBA-01BR-0080
错误码
错误标识
错误显示信息
GBA-01BR-0080

recover gbase sysdb Error

GBase 8a MPP Cluster 产品手册
7 附录
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
1703
错误出现原因
恢复gbase 系统数据库失败
分析与建议
检查gbase 系统数据库备份数据

rdefmtdate() 函数使用格式化掩码来将字符串转换为内部的 DATE 格式。

语法
mint rdefmtdate(jdate, fmtstring, inbuf)
int4 *jdate;

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 854 -
char *fmtstring;
char *inbuf;
jdate
指向接收 inbuf 字符串的内部 DATE 值的 int4 整数值的指针。
fmtstring
指向包含要使用 inbuf 字符串的的格式化掩码的缓冲区的指针。
inbuf
指向包含要转换的日期字符串的缓冲区的指针。
用法
rdefmtdate() 函数的 fmtstring 参数指向日期格式化掩码,其包含描述
如何解释该日期字符串的格式。

input 字符串和 fmtstring 必须以相同的月份、日期和年份的序列顺序。然而,它们不
需要包含相同的文字,或月份、日期和年份的相同表示。

在 fmtstring 中,您可包括 weekday 格式(ww),但数据库服务器忽略该格式。inbuf
中没有与 weekday 格式对应的内容。

下列 fmtstring 与 input 的组合是有效的。
格式化掩码输入
mmddyy
Dec. 25th, 2007
mmddyyyy
Dec. 25th, 2007
mmm. dd. yyyy
dec 25 2007
mmm. dd. yyyy
DEC-25-2007
mmm. dd. yyyy
122507
mmm. dd. yyyy
12/25/07
yy/mm/dd

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 855 -
07/12/25
yy/mm/dd
2007, December 25
yy/mm/dd
In the year 2007, the month of December, it is the 25th day
dd-mm-yy
This 25th day of December 2007

如果存储在 inbuf 中的值是四位年份。则 rdefmtdate() 函数使用那个值。如果存储在
inbuf 中的值是两位年份,
则 rdefmtdate() 函数使用 DBCENTURY 环境变量的值来确定要
使用哪个世纪。如果您未设置 DBCENTURY,则 GBase 8s ESQL/C 使用 20 世纪。

返回代码
如果您使用无效的日期字符串格式,则 rdefmtdate() 返回错误代码,并将该内部的
DATE 设置为当前日期。下列为可能的返回代码。
0
操作成功。
-1204
*input 参数指定无效的年份。
-1205
*input 参数指定无效的月份。
-1206
*input 参数指定无效的日期。
-1209
由于 *input 不包含年份、月份和日期之间的定界符,则 *input 的长度必须恰好为 6
或 8 字节。
-1212
*fmtstring 未指定年份、月份和日期。

示例
demo 目录在 rdefmtdate.ec 文件中包含此样例程序。
/*
* rdefmtdate.ec *

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 856 -

The following program accepts a date entered from the console, converts it into the internal
date format using rdefmtdate(). It checks the conversion by finding the day of the week.
*/

#include

main()
{
mint x;
char date[20];
int4 i_date;
char *day_name;

static char fmtstr[9] = "mmddyyyy";

printf("RDEFMTDATE Sample ESQL Program running.\n\n");

printf("Enter a date as a single string, month.day.year\n");
gets(date);

printf("\nThe date string is %s.\n", date);

if (x = rdefmtdate(&i_date, fmtstr, date))
printf("Error %d on rdefmtdate conversion\n", x);
else
{
/* Figure out what day of the week i_date is */
switch (rdayofweek(i_date))
{
case 0: day_name = "Sunday";
break;
case 1: day_name = "Monday";

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 857 -
break;
case 2: day_name = "Tuesday";
break;
case 3: day_name = "Wednesday";
break;
case 4: day_name = "Thursday";
break;
case 5: day_name = "Friday";
break;
case 6: day_name = "Saturday";
break;
}
printf("\nThe day of the week is %s.\n", day_name);
}

printf("\nRDEFMTDATE Sample Program over.\n\n");
}
输出
RDEFMTDATE Sample ESQL Program running.

Enter a date as a single string, month.day.year
080894

The date string is 080894
The day of the week is Monday.
RDEFMTDATE Sample Program over.

这些主题将讨论如何执行外部备份以及通过使用 ontape 实用程序将其恢复来恢复数据。