返回首页

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

更新日期:2024年09月11日

取值0,1,2。默认取0。
0 表示使用原有方式创建镜像,同时跨VC 同步主备分片。
1 表示先跨VC 同步主分片,再VC 内同步备分片。
2 表示只跨VC 同步主分片,备分片记录FEVENTLOG。

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

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

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

示例
demo 目录中的文件 int8todec.ec 包含下列样例程序。
/*
* ifx_int8todec.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_INT8tODEC 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_int8todec(&num1,&d)");
if (x= ifx_int8todec(&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_int8todec(&num2, &d)");
if (x= ifx_int8todec(&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_int8todec(&num3, &d)");
if (x= ifx_int8todec(&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_INT8tODEC Sample Program over.\n\n");
exit(0);
}
输出
IFX_INT8tODEC Sample ESQL Program running.


***Converting INT8 to decimal

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

Executing: ifx_int8todec(&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_int8todec(&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_int8todec(&num3, &d)
Converting Decimal to ASCII for display

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

Executing: dectoasc(&d, result, END, -1)
Result = 5.0
IFX_INT8tODEC Sample Program over.

GBase 8s 系统的高可用集群有共享存储集群、容灾集群三种,并支持组合,
实现两地三中心高可用部署。集群切换可通过连接管理器(CM)组件实现。其
中,

灾备集群HAC(High availability cluster)根据备份距离不同分为同城灾
备集群和异地灾备集群。HAC 技术是一种将数据从主服务器复制到备

GBase 8s V8.8 技术白皮书
第18页
南大通用数据技术股份有限公司
服务器的技术。异地灾备集群是同城容灾的扩展,提供远程的容灾备
份方案,同城容灾备集群支持同步、半同步、异步三种模式,异地灾
备集群支持异步模式;

共享存储集群SSC(Shared storage cluster) 通过多个节点对外提供服务,
保障系统高可用。数据保存在共享存储上,所有节点共享一份数据。
当主节点出现故障时,备节点将自动、快速接管主节点服务。

企业级复制Enterprise Replication(ER)是基于日志的异步工具,用于
在GBase 8s Server 数据库服务器之间复制数据。源服务器上的
Enterprise Replication 通过读取逻辑日志,存储事务并将每个事务作为
复制数据可靠传输至目标服务器。

连接管理器(CM)是一个轻量级连接管理组件,位于应用程序和8s
高可用数据库集群之间,根据集群状态提供负载均衡及故障接管功能,
支持代理和重定向两种模式。