返回首页

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

更新日期:2024年09月11日

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

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

返回代码

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

0
转换成功。
<0
转换失败。
示例
demo 目录中的文件 int8cvint.ec 包含下列样例程序。
/*
* ifx_int8cvint.ec *

The following program converts two integers to INT8
types and displays the results.
*/

#include

EXEC SQL include "int8.h";

char result[41];

main()
{
mint x;
ifx_int8_t num;

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

printf("Integer 1 = 129449233\n");
if (x = ifx_int8cvint(129449233, #))
{
printf("Error %d in converting int1 to INT8\n", x);
exit(1);
}

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


/* 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("Integer 2 = -33\n");
if (x = ifx_int8cvint(-33, #))
{
printf("Error %d in converting int2 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 second INT8 type value is = %s\n", result);

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

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


Integer 1 = 129449233
The INT8 type value is = 129449233
Integer 2 = -33
The second INT8 type value is = -33

参数说明:cm_agent 连接cm_server 尝试次数。
取值范围:整型。修改后需要重启cm_agent 才能生效。参数修改请参考表GUC 参数
设置方式进行设置。
默认值:15

以gbasedbt用户身份,将/opt/GBASE/gbase/etc/目录中的onconfig.std文件复制一份,
命名为profile.gbaseserver中$ONCONFIG变量指定的名称onconfig.gbaerserver。
[gbasedbt@PRIMARY etc]$ cp onconfig.std onconfig.gbaseserver
[gbasedbt@PRIMARY etc]$ vim onconfig.gbaseserver
主要参数说明如下:
参数

说明
ROOTNAME
rootdbs
指定数据库服务器root dbspace的名称
ROOTPATH
$GBASEDBTDIR/gbaseser
指定root dbspace的初始chunk全路径名,

GBase 8s 共享存储集群安装手册
南大通用数据技术股份有限公司 - 5 -
ver_dbs/rootdbs
包括设备或文件
ROOTSIZE
500000
指定以KB为单位的root dbspace的初始
chunk的大小,500000即500M左右
PHYSFILE
100000
指定物理日志文件大小,100000即100M
左右
MSGPATH
$GBASEDBTDIR/gbaseser
ver.log
指定消息日志文件的全路径名
DBSPACETEMP
dbspacetemp
指定临时数据空间的名称
SBSPACETEMP
sbspacetemp
指定临时智能大对象空间的名称
SBSPACENAME
sbspace
指定智能大对象空间的名称
SERVERNUM
1
指定共享内存中的相对位置,取值范围
为0-255,多个数据库实例时候需要确保
SERVERNUM唯一
DBSERVERNAME
gbaseserver
数据库实例名
DRAUTO
3
指定由连接管理器控制
SDS_ENABLE
0,从节点的值修改为1
是否启用辅助服务器功能
SDS_TEMPDBS
sdstempdbspace,$GBASE
DBTDIR/sds_dbs/sdstem
pdbspace,2,0,51200
指定共享磁盘辅助服务器用于动态地创
建临时数据空间的信息
SDS_PAGING
$GBASEDBTDIR/sds_dbs/
paging1,$GBASEDBTDIR/s
ds_dbs/paging2
指定两个作为缓冲区的文件信息

注意:相关参数中用到的文件不存在的需要以gbasedbt用户身份touch。
[gbasedbt@PRIMARY etc]$ cd /opt/GBASE/gbase/
[gbasedbt@PRIMARY gbase]$ mkdir sds_dbs
[gbasedbt@PRIMARY gbase]$ cd sds_dbs
[gbasedbt@PRIMARY sds_dbs]$ touch sdstempdbspace paging1 paging2
[gbasedbt@PRIMARY sds_dbs]$ chmod 660 sdstempdbspace paging1 paging2
由于默认权限高为了安全需要chown为660