当前位置:网站首页>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 .
边栏推荐
- Oracle 中文排序 Oracle 中文字段排序
- 蚂蚁集团开源可信隐私计算框架「隐语」:开放、通用
- 集合处理的利器
- 达梦数据库udf实现
- Rse2020/ cloud detection: accurate cloud detection of high-resolution remote sensing images based on weak supervision and deep learning
- Pytorch yolov5 training custom data
- Low code practice of xtransfer, a cross-border payment platform: how to integrate with other medium-sized platforms is the core
- 2022最新中高级Android面试题目,【原理+实战+视频+源码】
- c语言简便实现链表增删改查「建议收藏」
- Video fusion cloud platform easycvr adds multi-level grouping, which can flexibly manage access devices
猜你喜欢

The road of enterprise digital transformation starts from here

vs2017 qt的各种坑

SAP feature description

Reading notes of Clickhouse principle analysis and Application Practice (5)

Chinese postman? Really powerful!

Take a look at semaphore, the current limiting tool provided by JUC

Summary of six points of MySQL optimization

瞅一瞅JUC提供的限流工具Semaphore

Pytorch yolov5 training custom data

企业级数据安全,天翼云是这样理解的
随机推荐
达梦数据库udf实现
Use QT to traverse JSON documents and search sub objects
Use of websocket tool
XML basic knowledge concept
About Estimation with Cross-Validation
Problems encountered in the project u-parse component rendering problems
7-2 keep the linked list in order
2022年阿里Android高级面试题分享,2022阿里手淘Android面试题目
2022 latest Android interview written examination, an Android programmer's interview experience
Shang Silicon Valley Shang preferred project tutorial release
Common time complexity
Trust counts the number of occurrences of words in the file
中文版Postman?功能真心强大!
Lombok @builder annotation
Deep copy and shallow copy [interview question 3]
sample_rate(采樣率),sample(采樣),duration(時長)是什麼關系
使用文件和目录属性和属性
What are the cache interfaces of nailing open platform applet API?
Personal understanding of convolutional neural network
蚂蚁集团开源可信隐私计算框架「隐语」:开放、通用