当前位置:网站首页>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 .
边栏推荐
- AI金榜题名时,MLPerf榜单的份量究竟有多重?
- Common time complexity
- 企业数字化转型之路,从这里开始
- How to write good code defensive programming
- How much does the mlperf list weigh when AI is named?
- Take a look at semaphore, the current limiting tool provided by JUC
- Low code practice of xtransfer, a cross-border payment platform: how to integrate with other medium-sized platforms is the core
- 2022 latest intermediate and advanced Android interview questions, [principle + practice + Video + source code]
- Rse2020/ cloud detection: accurate cloud detection of high-resolution remote sensing images based on weak supervision and deep learning
- Reading notes of Clickhouse principle analysis and Application Practice (5)
猜你喜欢
随机推荐
Isprs2020/ cloud detection: transferring deep learning models for cloud detection between landsat-8 and proba-v
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
Cronab log: how to record the output of my cron script
How much does the mlperf list weigh when AI is named?
瞅一瞅JUC提供的限流工具Semaphore
Personal understanding of convolutional neural network
Use file and directory properties and properties
Use QT to traverse JSON documents and search sub objects
Isprs2022/ cloud detection: cloud detection with boundary nets
Word finds red text word finds color font word finds highlighted formatted text
在通达信上做基金定投安全吗?
2022最新Android面试笔试,一个安卓程序员的面试心得
常见时间复杂度
Oracle 中文排序 Oracle 中文字段排序
线性表——抽象数据类型
音视频包的pts,dts,duration的由来.
RedHat7.4配置yum软件仓库(RHEL7.4)
SAP 特征 特性 说明
7-2 保持链表有序
Solutions contents have differences only in line separators