返回首页

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

更新日期:2024年09月11日

ifx_int8cvasc() 函数将 C char 类型中保存作为可打印的字符的值转换为 int8 类
型数值。
语法

mint ifx_int8cvasc(strng_val, len, int8_val)

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 722 -
char *strng_val
mint len;
ifx_int8_t *int8_val;
strng_val
指向字符串的指针。
len
strng_val 字符串的长度。
int8_val
指向 ifx_int8cvasc() 放置转换的结果处的 int8 结构的指针。

用法
字符串 strng_val 可包含下列符号:
开头的符号,或为正(+)或为负(-)。
在 e 或 E 前面的指数。您可在该指数前面加符号,或为正(+)或为负(-)。

strng_val 字符串在小数点分隔符的右边不包含小数点分隔符或数字。ifx_int8cvasc()
函数截断小数点分隔符右边的小数点分隔符和任何数字。
ifx_int8cvasc() 函数忽略该字符串
中开头的空格。
当您使用非缺省的语言环境(US English 之外的一种)时,ifx_int8cvasc() 支持
strng_val 字符串中的非 ASCII 字符。

返回代码
0
转换成功。
-1213
字符串有非数值的字符。
-1284
操作导致溢出或下溢。

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

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 723 -
* ifx_in8cvasc.ec *
The following program converts three strings to INT8
types and displays the values stored in each field of
the INT8 structures.
*/

#include

EXEC SQL include "int8.h";

char string1[] = "-12,555,444,333,786,456";
char string2[] = "480";
char string3[] = "5.2";
main()
{
mint x;
ifx_int8_t num1, num2, num3;
void nullterm(char *, mint);

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

if (x = ifx_int8cvasc(string1, strlen(string1), &num1))
{
printf("Error %d in converting string1 to INT8\n", x);
exit(1);
}
if (x = ifx_int8cvasc(string2, strlen(string2), &num2))
{
printf("Error %d in converting string2 to INT8\n", x);
exit(1);
}
if (x = ifx_int8cvasc(string3, strlen(string3), &num3))
{

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 724 -
printf("Error %d in converting string3 to INT8\n", x);
exit(1);
}

/* Display the exponent, sign value and number of digits in num1. */

ifx_int8soasc(&num1, string1, sizeof(string1));
nullterm(string1, sizeof(string1));
printf("The value of the first INT8 is = %s\n", string1);

/* Display the exponent, sign value and number of digits in num2. */

ifx_int8soasc(&num2, string2, sizeof(string2));
nullterm(string2, sizeof(string2));
printf("The value of the 2nd INT8 is = %s\n", string2);

/* Display the exponent, sign value and number of digits in num3. */
/* Note that the decimal is truncated */

ifx_int8soasc(&num3, string3, sizeof(string3));
nullterm(string3, sizeof(string3));
printf("The value of the 3rd INT8 is = %s\n", string3);

printf("\nIFX_INT8CVASC Sample Program over.\n\n");
exit(0);
}
void nullterm(char *str, mint size)
{
char *end;

end = str + size;
while(*str && *str > ' ' && str <= end)
++str;

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 725 -
*str = '\0';
}
输出

IFX_INT8CVASC Sample ESQL Program running.

The value of the first INT8 is = -12555444333786456
The value of the 2nd INT8 is = 480
The value of the 3rd INT8 is = 5

recovery_max_workers
参数说明:设置最大并行回放线程个数。
该参数属于POSTMASTER 类型参数,请参考表15-1 中对应设置方法进行设置。
取值范围:整型,0~20
默认值:1(安装工具默认设置为4,以获得更好的性能)


GBase 8c V5 开发者手册
南大通用数据技术股份有限公司
59