当前位置:网站首页>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/ -ldmde
String 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 .
边栏推荐
- Tupu software digital twin smart wind power system
- The origin of PTS, DTS and duration of audio and video packages
- 华律网牵手观测云,上线系统全链路可观测平台
- Emqx 5.0 officially released: a single cluster supports 100million mqtt connections
- CDB 实例的启动与关闭
- The easycvr authorization expiration page cannot be logged in. How to solve it?
- IDEA配置npm启动
- 如何快速进阶自动化测试?听听这3位BAT大厂测试工程师的切身感想....
- 2022最新Android面试笔试,一个安卓程序员的面试心得
- Chinese postman? Really powerful!
猜你喜欢
LeetCode 6109. Number of people who know the secret
[HCIA cloud] [1] definition of cloud computing, what is cloud computing, architecture and technical description of cloud computing, Huawei cloud computing products, and description of Huawei memory DD
vs2017 qt的各种坑
FCN: Fully Convolutional Networks for Semantic Segmentation
Various pits of vs2017 QT
The 2022 China Xinchuang Ecological Market Research and model selection evaluation report released that Huayun data was selected as the mainstream manufacturer of Xinchuang IT infrastructure!
You can have both fish and bear's paw! Sky wing cloud elastic bare metal is attractive!
Word查找红色文字 Word查找颜色字体 Word查找突出格式文本
【HCIA-cloud】【1】云计算的定义、什么是云计算、云计算的架构与技术说明、华为云计算产品、华为内存DDR配置工具说明
Oracle日期格式转换 to_date,to_char,to_timetamp 相互转换
随机推荐
Common time complexity
Summary of six points of MySQL optimization
小程序 修改样式 ( placeholder、checkbox的样式)
2022全网最全的腾讯后台自动化测试与持续部署实践【万字长文】
LeetCode 6109. 知道秘密的人数
技术分享 | 接口测试价值与体系
华律网牵手观测云,上线系统全链路可观测平台
2022年5月腾讯云开发者社区视频月度榜单公布
@Extension, @spi annotation principle
Word查找红色文字 Word查找颜色字体 Word查找突出格式文本
websocket 工具的使用
C language makes it easy to add, delete, modify and check the linked list "suggested collection"
蚂蚁集团开源可信隐私计算框架「隐语」:开放、通用
一文读懂简单查询代价估算
c期末复习
Linear table - abstract data type
5. 数据访问 - EntityFramework集成
Is it safe to open an account and register stocks for stock speculation? Is there any risk? Is it reliable?
Video fusion cloud platform easycvr adds multi-level grouping, which can flexibly manage access devices
The road of enterprise digital transformation starts from here