返回首页

gbase数据、南大通用产品文档:GBase8sifx_int8cvflt() 函数

更新日期:2024年09月11日

ifx_int8cvflt() 函数将 C float 类型数值转换为 int8 类型数值。
语法

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

mint ifx_int8cvflt(flt_val, int8_val)
double flt_val;
ifx_int8_t *int8_val;
flt_val
ifx_int8cvflt() 要将其转换为 int8 类型值的 float 值。
int8_val
指向 ifx_int8cvflt() 放置转换的结果处的 int8 结构的指针。

返回代码
0
转换成功。
<0
转换失败。

示例
demo 目录中的文件 int8cvflt.ec 包含下列样例程序。
/*
* ifx_int8cvflt.ec *
The following program converts two floats to INT8 types and displays the results.
*/

#include

EXEC SQL include "int8.h";

char result[41];

main()
{
mint x;
ifx_int8_t num;


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

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

printf("Float 1 = 12944.321\n");

/* Note that in the following conversion, the digits to the right of the decimal are ignored.
*/

if (x = ifx_int8cvflt(12944.321, #))
{
printf("Error %d in converting float1 to INT8\n", x);
exit(1);
}

/* Convert int8 to ascii to display value. */

if (x = ifx_int8toasc(#, result, sizeof(result)))
{
printf("Error %d in converting INT8 to string\n", x);
exit(1);
}
result[40] = '\0';
printf(" The INT8 type value is = %s\n", result);
printf("Float 2 = -33.43\n");

/* Note that in the following conversion, the digits to the right of the decimal are ignored.
*/

if (x = ifx_int8cvflt(-33.43, #))
{
printf("Error %d in converting float2 to INT8\n", x);
exit(1);
}
if (x = ifx_int8toasc(#, result, sizeof(result)))

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

{
printf("Error %d in converting INT8 to string\n", x);
exit(1);
}
result[40] = '\0';
printf(" The second INT8 type value is = %s\n", result);

printf("\nIFX_INT8CVFLT Sample Program over.\n\n");
exit(0);
}
输出

IFX_INT8CVFLT Sample ESQL Program running.

Float 1 = 12944.321
The INT8 type value is = 12944
Float 2 = -33.43
The second INT8 type value is = -33
IFX_INT8CVFLT Sample Program over.

auth_iteration_count
参数说明:认证加密信息生成过程中使用的迭代次数。
该参数属于SIGHUP 类型参数,请参考表15-1 中对应设置方法进行设置。
取值范围:整型,2048-134217728。
默认值:10000
须知:

GBase 8c V5 开发者手册
南大通用数据技术股份有限公司
1160
迭代次数设置过小会降低口令存储的安全性,
设置过大会导致认证、
用户创建等涉及口
令加密的场景性能劣化,请根据实际硬件条件合理设置迭代次数,推荐采用默认迭代次数。

[gbase@gbasehost ~]$ gs_tar -D /home/gbase/test/dn1 -F
/home/test/trunk/install/data/backup/base.tar

GBase 8c 工具参考手册
南大通用数据技术股份有限公司
242