返回首页

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

更新日期:2024年09月11日

node (192.168.146.42)
backup table begin

因为 GBase 8s ODBC Driver 在 UNIX(TM) 平台上支持不同类型的 Unicode,因此应用程
序使用的 Unicode 类型必须在 odbc.ini 文件的 ODBC 部分中指明。
在 ODBC 部分中指示 Unicode 的类型,如下所示:
[ODBC]
.
.
.
UNICODE=UCS-4
重要: 启用 Unicode 的应用程序必须在 odbc.ini 文件中指示 Unicode 的类型。如果未在 odbc.ini 中设
置 Unicode 参数,则缺省类型为 UCS-4。
要求所有的 UNIX(TM) ODBC 应用程序必须如下设置 odbc.ini 文件中的 Unicode 类型:

l
UNIX(TM) 上(包括 AIX 64 位)的 ANSI ODBC 应用程序必须设置
UNICODE=UCS-4
l
GBase AIX 32 位上的 ANSI ODBC 应用程序必须设置 UNICODE-UCS-2
l
使用 Data Direct(之前称为 Merant)ODBC 驱动程序管理器的 ANSI ODBC 应用
程序不会在文件中指示不是 UTF-8 的 Unicode 类型。
下表提供了 odbc.ini 设置的概述:
平台
驱动程序管理器
odbc.ini 设置
AIX
Data Direct
UTF-8
AIX 32–位
DMR or none
UCS-2
AIX 64–位
Data Direct
UTF-8
UNIX(TM)
Data Direct
UTF-8
UNIX(TM)
DMR 或无
UCS-4

GBase 8s ODBC Driver 程序员指南
南大通用数据技术股份有限公司
- 246 -

平台
驱动程序管理器
odbc.ini 设置
Windows(TM)
Windows(TM) ODBC Driver
Manager
N/A

重要:
如果下列条件都满足,则设置会自动重置,且不会发出警告或错误消息:
l 该应用程序是一个 ANSI 应用程序。
l 正在与 DMR 链接或没有链接。
l odbc.ini 文件中的 Unicode 设置与表中显示的值不匹配。

ifx_int8mul() 函数将两个 int8 类型值相乘。
语法

mint ifx_int8mul(n1, n2, product)
ifx_int8_t *n1;
ifx_int8_t *n2;
ifx_int8_t *product;
n1
指向包含第一个操作对象的 int8 结构的指针。
n2
指向包含第二个操作对象的 int8 结构的指针。
product
指向包含 n1 * n2 的乘积的 int8 结构的指针。

用法
product 可与 n1 或 n2 相同。

返回代码
0
运算成功。
-1284
运算导致溢出或下溢。

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

The following program multiplies two INT8 numbers and

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

displays the result.
*/

#include

EXEC SQL include "int8.h";

char string1[] = "480,999,777,666,345";
char string2[] = "80";
char result[41];

main()
{
mint x;
ifx_int8_t num1, num2, prd;

printf("IFX_INT8MUL 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_int8mul(&num1, &num2, &prd))
{
printf("Error %d in multiplying num1 by num2\n", x);
exit(1);
}

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

if (x = ifx_int8toasc(&prd, result, sizeof(result)))
{
printf("Error %d in converting product to string\n", x);
exit(1);
}
result[40] = '\0';
printf("\t%s * %s = %s\n", string1, string2, result);

printf("\nIFX_INT8MUL Sample Program over.\n\n");
exit(0);
}
输出
IFX_INT8MUL Sample ESQL Program running.

480,999,777,666,345 * 80 = 38479982213307600

IFX_INT8MUL Sample Program over.