返回首页

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

更新日期:2024年09月11日

bycopy() 函数将给定的字节数从一个位置复制到另一个。

语法
void bycopy(from, to, length)
char *from;
char *to;

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 614 -
mint length;
from
指向您想要 bycopy() 复制的该组字节的第一个字节的指针。
to
指向目的字节组的第一个字节的指针。
to 指向的内存区域可与 from 参数指向的区域
交叠。在此情况下,GBase 8s ESQL/C 不保留 from 指向的值。
length
您想要 bycopy() 复制的字节数。
重要: 请注意,不要重写目标区域相邻的内存区域。

示例
此示例程序位于 demo 目录中的 bycopy.ec 文件中。
/*
* bycopy.ec *

The following program shows the results of bycopy() for three copy operations.
*/

#include

char dest[20];

main()
{
mint number1 = 12345;
mint number2 = 0;
static char string1[] = "abcdef";
static char string2[] = "abcdefghijklmn";

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

printf("String 1=%s\tString 2=%s\n", string1, string2);
printf(" Copying String 1 to destination string:\n");

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 615 -
bycopy(string1, dest, strlen(string1));
printf(" Result = %s\n\n", dest);

printf(" Copying String 2 to destination string:\n");
bycopy(string2, dest, strlen(string2));
printf(" Result = %s\n\n", dest);

printf("Number 1=%d\tNumber 2=%d\n", number1, number2);
printf(" Copying Number 1 to Number 2:\n");
bycopy( (char *) &number1, (char *) &number2, sizeof(int));
printf(" Result = number1(hex) %08x, number2(hex) %08x\n",
number1, number2);

printf("\nBYCOPY Sample Program over.\n\n");
}
输出
BYCOPY Sample ESQL Program running.

String 1=abcdef String2=abcdefghijklmn
Copying String 1 to destination string:
Result = abcdef

Copying String 2 to destination string:
Result = abcdefghijklmn

Number 1=12345 Number2=0
Copying Number 1 to Number 2:
Result = number1(hex) 00003039, number2(hex) 00003039

BYCOPY Sample Program over.

GBA-01BR-0061
错误码
错误标识
错误显示信息
GBA-01BR-0061

Get bak table DC info failed
错误出现原因
获取表备份bsi 错误
分析与建议

GBase 8a MPP Cluster 产品手册
7 附录
文档版本953(2022-09-15)
南大通用数据技术股份有限公司
1689
分析与建议
检查表备份数据bsi 文件

检查操作系统日志
建议按月检查操作系统日志,排除操作系统运行异常隐患。以超级用户(如root),查
看操作系统日志文件。
[root@gbase8c ~]$ vim /var/log/messages
关注其中近一个月出现的kernel、error、fatal 等字样,根据系统报警信息进行处理。