返回首页

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

更新日期:2024年09月11日

GBaseConnection 类构造函数。
函数名称
返回值
返回值类型
函数参数
参数含义
GBaseConnectio
instanc
GBaseConnect
**kwargs
连接参数,以字

GBase Python 接口开发手册


- 20 -

南大通用数据技术股份有限公司
样例代码:
code
from GBaseConnector import connect
config = {'host' : '172.16.3.10',
'port' : 5258,
'user' : 'gbase',
'password' : 'gbase20110531',
'database' : 'test'}
conn = GBaseConnection(**config)

# 使用下面的方法初始化连接,也返回GBaseConnection 对象
conn = connect(**config)

ifx_int8cvlong() 函数将 C long 类型值转换为 int8 类型值。
语法
mint ifx_int8cvlong(lng_val, int8_val)
int4 lng_val;
ifx_int8_t *int8_val;
lng_val
ifx_int8cvlong() 将其转换为 int8 类型值的 int4 整数。
int8_val
指向 ifx_int8cvlong() 放置转换的结果处的 int8 结构的指针。

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

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

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


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

#include

EXEC SQL include "int8.h";

char result[41];

main()
{
mint x;
ifx_int8_t num;
int4 n;

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

printf("Long Integer 1 = 129449233\n");
if (x = ifx_int8cvlong(129449233L, #))
{
printf("Error %d in converting long to INT8\n", x);
exit(1);
}
if (x = ifx_int8toasc(#, result, sizeof(result)))
{
printf("Error %d in converting INT8 to string\n", x);
exit(1);
}
result[40] = '\0';
printf(" String for INT8 type value = %s\n", result);

n = 2147483646; /* set n */
printf("Long Integer 2 = %d\n", n);
if (x = ifx_int8cvlong(n, #))
{
printf("Error %d in converting long to INT8\n", x);

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

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

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

Long Integer 1 = 129449233
String for INT8 type value = 129449233
Long Integer 2 = 2147483646
String for INT8 type value = 2147483646
IFX_INT8CVLONG Sample Program over.

ARCHIVE_SNAPSHOT 是DB4AI 特性用于存档快照的接口函数。通过语法ARCHIVE
SNAPSHOT 调用。生效后的快照无法参数训练等任务。
参数
类型
描述
i_schema
IN NAME
快照存储的模式名字,默认
值是当前用户
i_name
IN NAME
快照名称
res
OUT db4ai.snapshot_name
结果

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