当前位置:网站首页>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 .
边栏推荐
- 中文版Postman?功能真心强大!
- 关于服装ERP,你想知道的都在这里了
- Insufficient picture data? I made a free image enhancement software
- The worse the AI performance, the higher the bonus? Doctor of New York University offered a reward for the task of making the big model perform poorly
- 紧固件行业供应商绩效考核繁琐?选对工具才能轻松逆袭!
- Is it safe for Apple mobile phone to speculate in stocks? Is it a fraud to get new debts?
- Linear table - abstract data type
- Oracle 中文排序 Oracle 中文字段排序
- Is it complicated to open an account? Is online account opening safe?
- 自动化测试的好处
猜你喜欢
The era of Web3.0 is coming. See how Tianyi cloud storage resources revitalize the system to enable new infrastructure (Part 2)
视频自监督学习综述
Rse2020/ cloud detection: accurate cloud detection of high-resolution remote sensing images based on weak supervision and deep learning
Case sharing | integrated construction of data operation and maintenance in the financial industry
RedHat7.4配置yum软件仓库(RHEL7.4)
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!
websocket 工具的使用
2022最新Android面试笔试,一个安卓程序员的面试心得
鱼和熊掌可以兼得!天翼云弹性裸金属一招鲜!
爬虫01-爬虫基本原理讲解
随机推荐
China law network joins hands to observe the cloud, and the online system is a full link observable platform
中文版Postman?功能真心强大!
[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
企业级数据安全,天翼云是这样理解的
基于can总线的A2L文件解析(3)
Optimization of middle alignment of loading style of device player in easycvr electronic map
SAP 特征 特性 说明
Reptile 01 basic principles of reptile
Solutions contents have differences only in line separators
Share: ZTE Yuanhang 30 Pro root unlock BL magick ZTE 7532n 8040n 9041n brush mask original brush package root method Download
Interprocess communication (IPC): shared memory
Problems encountered in the project u-parse component rendering problems
Is it safe to open an account, register and dig money? Is there any risk? Is it reliable?
EasyCVR授权到期页面无法登录,该如何解决?
线性表——抽象数据类型
Reading notes of Clickhouse principle analysis and Application Practice (5)
Precautions for RTD temperature measurement of max31865 module
一朵云开启智慧交通新未来
Emqx 5.0 officially released: a single cluster supports 100million mqtt connections
Redhat7.4 configure Yum software warehouse (rhel7.4)