返回首页

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

更新日期:2024年09月11日

数据库对象位置函数

pg_relation_filenode(relation regclass)
描述:指定关系的文件节点数。
返回值类型:oid
备注:pg_relation_filenode 接受一个表、索引、序列或压缩表的OID 或者名称,并且返
回当前分配给它的“filenode”数。文件节点是关系使用的文件名称的基本组件。对大多数
表来说,结果和pg_class.relfilenode 相同,但对确定的系统目录来说,relfilenode 为0 而且
这个函数必须用来获取正确的值。如果传递一个没有存储的关系,比如一个视图,
那么这个
函数返回NULL。

pg_relation_filepath(relation regclass)
描述:指定关系的文件路径名。
返回值类型:text
备注:
pg_relation_filepath 类似于pg_relation_filenode,
但是它返回关系的整个文件路径
名(相对于GBase 8c 的数据目录PGDATA)


pg_filenode_relation(tablespace oid, filenode oid)
描述:获取对应的tablespace 和relfilenode 所对应的表名。
返回类型:regclass

pg_partition_filenode(partition_oid)
描述:获取到指定分区表的oid 锁对应的filenode。
返回类型:oid

pg_partition_filepath(partition_oid)
描述:指定分区的文件路径名。
返回值类型:text

GBase 8c SQL 参考手册
南大通用数据技术股份有限公司
457

ifx_int8cvdec() 函数将 decimal 类型值转换为 int8 类型值。
语法
mint ifx_int8cvdec(dec_val, int8_val)

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 728 -
dec_t *dec_val;
ifx_int8_t *int8_val;
dec_val
指向 ifx_int8cvdec() 转换为 int8 类型值的 decimal 结构的指针。
int8_val
指向 ifx_int8cvdec() 放置转换的结果处的 int8 结构的指针。

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

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

The following program converts two INT8s types to DECIMALS and displays the results.
*/

#include

EXEC SQL include decimal;
EXEC SQL include "int8.h";

char string1[] = "2949.3829398204382";
char string2[] = "3238299493";
char result[41];

main()
{

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 729 -
mint x;
ifx_int8_t n;
dec_t num;

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

if (x = deccvasc(string1, strlen(string1), #))
{
printf("Error %d in converting string1 to DECIMAL\n", x);
exit(1);
}
if (x = ifx_int8cvdec(#, &n))
{
printf("Error %d in converting DECIMAL1 to INT8\n", x);
exit(1);
}

/* Convert the INT8 to ascii and display it. Note that the digits to the right of the decimal
are truncated in the conversion.
*/

if (x = ifx_int8soasc(&n, result, sizeof(result)))
{
printf("Error %d in converting INT8 to string\n", x);
exit(1);
}
result[40] = '\0';
printf("String 1 Value = %s\n", string1);
printf(" INT8 type value = %s\n", result);
if (x = deccvasc(string2, strlen(string2), #))
{
printf("Error %d in converting string2 to DECIMAL\n", x);
exit(1);

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 730 -
}
if (x = ifx_int8cvdec(#, &n))
{
printf("Error %d in converting DECIMAL2 to INT8\n", x);
exit(1);
}
printf("String 2 = %s\n", string2);

/* Convert the INT8 to ascii to display value. */

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

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

String 1 Value = 2949.3829398204382
INT8 type value = 2949
String 2 = 3238299493
INT8 type value = 3238299493
IFX_INT8CVDEC Sample Program over.

列存储和行列混存
...................................
8