返回首页

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

更新日期:2024年09月11日

取值:[0|1]
默认值:0
说明:分级查询支持做过删除操作的表。
修改方式:可使用set 语句修改值也可在配置文件中修改值。仅用于global 范围。

gbase_hex_string ............................ 20

ifx_int8sodec() 函数将 int8 类型数值转换为 decimal 类型数值。
语法

mint ifx_int8sodec(int8_val, dec_val)
ifx_int8_t *int8_val;
dec_t *dec_val;
int8_val
指向 ifx_int8sodec() 将其值转换为 decimal 类型值的 int8 结构的指针。
dec_val
指向 ifx_int8sodec() 在其中放置转换的结果的 decimal 结构的指针。

返回代码
0
转换成功。
<0
转换不成功。

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

The following program converts three strings to INT8 types and

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 755 -
converts the INT8 type values to decimal type values.
Then the values are displayed.

*/

#include

EXEC SQL include "int8.h";
#define END sizeof(result)

char string1[] = "-12,555,444,333,786,456";
char string2[] = "480";
char string3[] = "5.2";
char result [40];

main()
{
mint x;
dec_t d;
ifx_int8_t num1, num2, num3;
printf("IFX_INT8sODEC 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 编程指南
南大通用数据技术股份有限公司
- 756 -
{
printf("Error %d in converting string3 to INT8\n", x);
exit(1);
}

printf("\n***Converting INT8 to decimal\n");
printf("\nString 1= %s\n", string1);
printf(" \nExecuting: ifx_int8sodec(&num1,&d)");
if (x= ifx_int8sodec(&num1, &d))
{
printf("\tError %d in converting INT8 to decimal\n", x);
exit(1);
}
else
{
printf("\nConverting Decimal to ASCII for display\n");
printf("Executing: dectoasc(&d, result, END, -1)\n");
if (x = dectoasc(&d, result, END, -1))
printf("\tError %d in converting DECIMAL1 to string\n", x);
else
{
result[END - 1] = '\0'; /* null terminate */
printf("Result = %s\n", result);
}
}
printf("\n***Converting second INT8 to decimal\n");
printf("\nString2 = %s\n", string2);
printf(" \nExecuting: ifx_int8sodec(&num2, &d)");
if (x= ifx_int8sodec(&num2, &d))
{
printf("\tError %d in converting INT8 to decimal\n", x);
exit(1);
}

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 757 -
else
{
printf("\nConverting Decimal to ASCII for display\n");
printf("Executing: dectoasc(&d, result, END, -1)\n");
if (x = dectoasc(&d, result, END, -1))
printf("\tError %d in converting DECIMAL2 to string\n", x);
else
{
result[END - 1] = '\0'; /* null terminate */
printf("Result = %s\n", result);
}
}
printf("\n***Converting third INT8 to decimal\n");
printf("\nString3 = %s\n", string3);
printf(" \nExecuting: ifx_int8sodec(&num3, &d)");
if (x= ifx_int8sodec(&num3, &d))
{
printf("\tError %d in converting INT8 to decimal\n", x);
exit(1);
}
else
{
printf("\nConverting Decimal to ASCII for display\n");
printf("Executing: dectoasc(&d, result, END, -1)\n");

/* note that the decimal is truncated */

if (x = dectoasc(&d, result, END, -1))
printf("\tError %d in converting DECIMAL3 to string\n", x);
else
{
result[END - 1] = '\0'; /* null terminate */
printf("Result = %s\n", result);

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 758 -
}
}
printf("\nIFX_INT8sODEC Sample Program over.\n\n");
exit(0);
}
输出
IFX_INT8sODEC Sample ESQL Program running.


***Converting INT8 to decimal

String 1= -12,555,444,333,786,456

Executing: ifx_int8sodec(&num1,&d)
Converting Decimal to ASCII for display
Executing: dectoasc(&d, result, END, -1)
Result = -12555444333786456.0

***Converting second INT8 to decimal

String2 = 480

Executing: ifx_int8sodec(&num2, &d)
Converting Decimal to ASCII for display
Executing: dectoasc(&d, result, END, -1)
Result = 480.0

***Converting third INT8 to decimal

String3 = 5.2

Executing: ifx_int8sodec(&num3, &d)
Converting Decimal to ASCII for display

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 759 -
Executing: dectoasc(&d, result, END, -1)
Result = 5.0
IFX_INT8sODEC Sample Program over.