当前位置:网站首页>UDF implementation of Dameng database
UDF implementation of Dameng database
2022-07-05 18:54:00 【Q446512799】
The official introduction is very simple , Actually, it's a little pit
Header file reference
//-I/dm/dmdbms/include/
#include "de_pub.h"
Library file reference
-L/dm/dmdbms/bin/ -ldmdeString splicing code ( Function names must be uppercase , Otherwise, the creation succeeds , Call error 【[-7095]: Failed to load external function .】)
de_data C_CONCAT(de_args *args)
{
de_data de_ret;
char* str1;
char* str2;
char* str3;
int len1;
int len2;
str1 = (char*)de_get_str(args, 0); /* Take the... From the parameter list 0 Parameters */
str2 = (char*)de_get_str_with_len(args, 1, (udint4*)&len2); /* Take the... From the parameter list 1 The value and length of the parameters */
len1 = strlen(str1);
str3 = (char*)malloc(len1 + len2);
memcpy(str3, str1, len1);
memcpy(str3 + len1, str2, len2);
de_str_free((sdbyte*)str1); /* call get Function gets the string , You need to call this function to free the string space */
de_str_free((sdbyte*)str2);
de_ret = de_return_str_with_len((udbyte*)str3, len1 + len2); /* Return string */
free(str3);
return de_ret;
}Build dynamic library
Create a function
CREATE OR REPLACE FUNCTION C_CONCAT(A VARCHAR, B VARCHAR)
RETURN VARCHAR
EXTERNAL '/dm/dmdbms/bin/libtestudf.so' C_CONCAT USING C;
/Actual project use

notes : because c Write Dameng udf Is take the dmap agent (/dm/dmdbms/bin/dmap), So you need to start the agent first . If the library depends on external environment variables , You need to start it manually on the console that configures the environment variables dmap, Instead of running disql Command line console configuration , Otherwise, environment variables cannot be recognized normally .
边栏推荐
- LeetCode 6109. Number of people who know the secret
- EasyCVR授权到期页面无法登录,该如何解决?
- 2022 latest Android interview written examination, an Android programmer's interview experience
- Shang Silicon Valley Shang preferred project tutorial release
- Oracle日期格式转换 to_date,to_char,to_timetamp 相互转换
- Postman核心功能解析 —— 参数化和测试报告
- 爬虫01-爬虫基本原理讲解
- Insufficient picture data? I made a free image enhancement software
- Lombok @builder annotation
- SAP 特征 特性 说明
猜你喜欢

Isprs2022/ cloud detection: cloud detection with boundary nets

The road of enterprise digital transformation starts from here

深入底层C源码讲透Redis核心设计原理

2022全网最全的腾讯后台自动化测试与持续部署实践【万字长文】

Ant group open source trusted privacy computing framework "argot": open and universal

Web3.0时代来了,看天翼云存储资源盘活系统如何赋能新基建(下)

Pytorch yolov5 training custom data

MySQL数据库索引教程(超详细)

Oracle 中文排序 Oracle 中文字段排序

Summary of six points of MySQL optimization
随机推荐
Common time complexity
企业级数据安全,天翼云是这样理解的
Web3.0时代来了,看天翼云存储资源盘活系统如何赋能新基建(下)
《ClickHouse原理解析与应用实践》读书笔记(5)
7-2 保持链表有序
MySQL数据库索引教程(超详细)
中文版Postman?功能真心强大!
Powerful tool for collection processing
[detailed explanation of AUTOSAR 14 startup process]
Startup and shutdown of CDB instances
SAP 特征 特性 说明
Optimization of middle alignment of loading style of device player in easycvr electronic map
LeetCode 6111. Spiral matrix IV
Simple query cost estimation
一文读懂简单查询代价估算
sample_ What is the relationship between rate, sample and duration
线性表——抽象数据类型
The 11th China cloud computing standards and Applications Conference | China cloud data has become the deputy leader unit of the cloud migration special group of the cloud computing standards working
Is it complicated to open an account? Is online account opening safe?
2022全网最全的腾讯后台自动化测试与持续部署实践【万字长文】