返回首页

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

更新日期:2024年09月11日

该配置文件中给出的是连接数据库时所需要的相关参数,其格式如下:
GBase8t_utf-8=;NEWCODESET=utf-8,utf8,57372;CLIENT_LOCALE=zh_cn.utf8;DB_LOCALE=zh_cn.
utf8;
配置内容以键值对形式存在,其中键名规则为:
“数据库类型_paramId”
。数据库类型可以参考
DBConnection.xml 中每个连接配置的id 即为数据库类型。
parmaId 为用户自定义的,
在页面下拉
列表中展示时会以该Id 进行排序,
键名勿重复。
参数值即为连接数据库时所需要的参数内容,

意参数字符串要以连接字符开头。

GBase Migration Toolkit 迁移工具用户手册

南大通用数据技术股份有限公司 - 26 -
7 常见问题说明

表 5-78 具体信息如下:
plan_directive_name
资源计划指令名称
resource_plan_id
资源计划ID
consumer_group_id
消费组ID
resource_pool_id
资源池ID
comments
注释信息

dececvt() 和 decfcvt() 函数相似,对于“UNIX(TM) 程序员手册”的第三部分中
ECVT(3) 之下的子例程。dececvt() 函数的工作方式与 ecvt(3) 函数相同,decfcvt() 函数的
工作方式与 fcvt(3) 函数相同。它们都将 decimal 类型数值转换为 C char 类型值。

语法
char *dececvt(dec_val, ndigit, decpt, sign)
dec_t *dec_val;
mint ndigit;
mint *decpt;
mint *sign;

char *decfcvt(dec_val, ndigit, decpt, sign)
dec_t *dec_val;
mint ndigit;
mint *decpt;

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

mint *sign;
dec_val
指向包含您想要这些函数来转换的 decimal 值的 decimal 结构的指针。
ndigit
dececvt() 的 ASCII 字符串的长度。它是 decfcvt() 的小数点右边的数字的数目。
decpt
指向一个整数的指针,该整数是小数点相对于字符串起点的位置。*decpt 的负值或零
意味着在返回的数字的左边。
sign
指向结果的符号的指针。 如果结果的符号为负,则 *sign 非零;否则,*sign 为零。


用法

dececvt() 函数将 np 指向的 decimal 值转换为 ndigit ASCII 数字的以空结尾的字符
串,并返回指向该字符串的指针。对此函数的后续调用重写该字符串。

dececvt() 函数对低位数字四舍五入。

decfcvt() 函数与 dececvt() 相同,除了 ndigit 指定小数点右边的数字的数目,而不是
数字的总数目之外。

让 dec_val 指向 12345.67 的 decimal 值,并阻止除了 ndigit 之外的所有参数。对
于四个不同的 ndigit 值,下表展示 dececvt() 函数返回的值。

ndigit 值
返回字符串
*decpt 值
*sign
4
"1235"
5
0
10
"1234567000"
5
0
1
"1"
5
0
3
"123"
5
0

要获取 dec_val 和 ndigit 值的更多示例,请参阅 dececvt() 的示例上
dececvt.ec 演示程序的样例输出。

重要:
当您编写线程安全 GBase
8s
ESQL/C 应用程序时,
请不要使用 dececvt()

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

或 decfcvt() 库函数。
反而,
请使用它们的线程安全等价的 ifx_dececvt() 和
ifx_decfcvt() 函数。

dececvt() 的示例

demo 目录中的文件 dececvt.ec 包含下列样例程序。
/*
* dececvt.ec *

The following program converts a series of DECIMAL numbers to fixedm strings of 20
ASCII digits. For each conversion it displays the resulting string, the decimal position from
the beginning of the string and the sign value.
*/

#include

EXEC SQL include decimal;


char *strings[] =
{
"210203.204",
"4894",
"443.334899312",
"-12344455",
"12345.67",
".001234",
0
};

char result[40];

main()
{

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

mint x;
mint i = 0, f, sign;
dec_t num;
char *dp, *dececvt();

printf("DECECVT Sample ESQL Program running.\n\n");
while(strings[i])
{
if (x = deccvasc(strings[i], strlen(strings[i]), #))
{
printf("Error %d in converting string [%s] to DECIMAL\n",x, strings[i]);
break;
}
printf("\Input string[%d]: %s\n", i, strings[i]);

/* to 20-char ASCII string */

dp = dececvt(#, 20, &f, &sign);
printf(" Output of dececvt(#, 20, ...): %c%s decpt: %d sign: %d\n",
(sign ? '-' : '+'), dp, f, sign);

/* display result */

/* to 10-char ASCII string */

dp = dececvt(#, 10, &f, &sign);
printf(" Output of dececvt(#, 10, ...): %c%s decpt: %d sign: %d\n",(sign ? '-' : '+'),
dp, f, sign);

/* to 4-char ASCII string */

dp = dececvt(#, 4, &f, &sign);


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

/* display result */
printf(" Output of dececvt(#, 4, ...): %c%s decpt: %d
sign: %d\n",(sign ? '-' : '+'), dp, f, sign);

/* to 3-char ASCII string */
dp = dececvt(#, 3, &f, &sign);

/* display result */
printf(" Output of dececvt(#, 3, ...): %c%s decpt: %d sign: %d\n", (sign ? '-' : '+'),
dp, f, sign);

/* to 1-char ASCII string */
dp = dececvt(#, 1, &f, &sign);

/* display result */
printf(" Output of dececvt(#, 1, ...): %c%s decpt:
%d sign: %d\n",(sign ? '-' : '+'), dp, f, sign);

++i; /* next string */
}
printf("\nDECECVT Sample Program over.\n\n");
}
dececvt() 的输出
DECECVT Sample ESQL Program running.

Input string[0]: 210203.204
Output of dececvt: +2102 decpt: 6 sign: 0
Output of dececvt: +2102032040 decpt: 6 sign: 0
Output of dececvt: +2 decpt: 6 sign: 0
Output of dececvt: +210 decpt: 6 sign: 0

Input string[1]: 4894
Output of dececvt: +4894 decpt: 4 sign: 0

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

Output of dececvt: +4894000000 decpt: 4 sign: 0
Output of dececvt: +5 decpt: 4 sign: 0
Output of dececvt: +489 decpt: 4 sign: 0

Input string[2]: 443.334899312
Output of dececvt: +4433 decpt: 3 sign: 0
Output of dececvt: +4433348993 decpt: 3 sign: 0
Output of dececvt: +4 decpt: 3 sign: 0
Output of dececvt: +443 decpt: 3 sign: 0

Input string[3]: -12344455
Output of dececvt: -1234 decpt: 8 sign: 1
Output of dececvt: -1234445500 decpt: 8 sign: 1
Output of dececvt: -1 decpt: 8 sign: 1
Output of dececvt: -123 decpt: 8 sign: 1

Input string[4]: 12345.67
Output of dececvt: +1235 decpt: 5 sign: 0
Output of dececvt: +1234567000 decpt: 5 sign: 0
Output of dececvt: +1 decpt: 5 sign: 0
Output of dececvt: +123 decpt: 5 sign: 0

Input string[5]: .001234
Output of dececvt: +1234 decpt: -2 sign: 0
Output of dececvt: +1234000000 decpt: -2 sign: 0
Output of dececvt: +1 decpt: -2 sign: 0
Output of dececvt: +123 decpt: -2 sign: 0

DECECVT Sample Program over.

decfcvt() 的示例

demo 目录中的文件 decfcvt.ec 包含下列示例程序。

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

/*
* decfcvt.ec *
The following program converts a series of DECIMAL numbers to strings of ASCII
digits with 3 digits to the right of the decimal point. For each conversion it displays the
resulting string, the position of the decimal point from the beginning of the string and the sign
value. */

#include

EXEC SQL include decimal;

char *strings[] =
{
"210203.204",
"4894",
"443.334899312",
"-12344455",
0
};

main()
{
mint x;
dec_t num;
mint i = 0, f, sign;
char *dp, *decfcvt();

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

while(strings[i])
{
if (x = deccvasc(strings[i], strlen(strings[i]), #))
{
printf("Error %d in converting string [%s] to DECIMAL\n", x, strings[i]);

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

break;
}

dp = decfcvt(#, 3, &f, &sign); /* to ASCII string */

/* display result */
printf("Input string[%d]: %s\n", i, strings[i]);
printf(" Output of decfcvt: %c%*.*s.%s decpt: %d sign: %d\n\n", (sign ?
'-' : '+'), f, f, dp, dp+f, f, sign);
++i; /* next string */
}
printf("\nDECFCVT Sample Program over.\n\n");
}
decfcvt() 的输出

DECFCVT Sample ESQL Program running.

Input string[0]: 210203.204
Output of decfcvt: +210203.204 decpt: 6 sign: 0

Input string[1]: 4894
Output of decfcvt: +4894.000 decpt: 4 sign: 0

Input string[2]: 443.334899312
Output of decfcvt: +443.335 decpt: 3 sign: 0

Input string[3]: -12344455
Output of decfcvt: -12344455.000 decpt: 8 sign: 1
DECFCVT Sample Program over.