Questions tagged [mysql-udf]

MySQL allows the creation of User Defined Functions, loadable into `mysqld` as shared libraries or dlls.

MySQL allows the creation and loading of User Defined Functions (UDFs) to extend the capabilities of MySQL servers.

If you own and operate your own MySQL server instance, you can consider using UDFs to extend its functionality. But, most hosting service providers offering shared MySQL servers do not allow customer-furnished UDFs.

You can find a repository of community-provided free UDFs (free as in kittens, free as in speech) at mysqludf.org. These include extensions for handling such things as regular expression replacement, cartographic projections, statistical analysis, JSON, and XML.

If you are capable of programming in C or C++ you can create your own UDF and load it into mysqld. The online MySQL documentation explains the basics.

MariaDB also supports UDFs.

26 questions
603
votes
13 answers

How to do a regular expression replace in MySQL?

I have a table with ~500k rows; varchar(255) UTF8 column filename contains a file name; I'm trying to strip out various strange characters out of the filename - thought I'd use a character class: [^a-zA-Z0-9()_ .\-] Now, is there a function in MySQL…
Piskvor left the building
  • 91,498
  • 46
  • 177
  • 222
12
votes
1 answer

MYSQL UDF function to return XML

Situation: I want to create a mysql function named XMLify, that takes in a string and an expression that will return a set XMLify(string, expr) The function should wrap each returned field of each returned row in the set, into its own XML tag. The…
nl-x
  • 11,762
  • 7
  • 33
  • 61
4
votes
1 answer

MYSQL trigger that externally launches a PHP script

I am currently trying to use a mysql trigger to launch a php script. When launched the script retrieves data from a particular website, and puts it into another table. I have tested the script, and it currently works when I run it using php5. I also…
user2872194
  • 147
  • 2
  • 12
3
votes
1 answer

MySQL UDF returns "Error Code: 1127. Can't find symbol 'xx' in library"

I have a MySQL UDF written in Go that used to work just fine, but if I compile now it no longer functions, with the error message Error Code: 1127. Can't find symbol 'get_url_param' in library The UDF is on GitHub here:…
Brian Leishman
  • 8,155
  • 11
  • 57
  • 93
3
votes
1 answer

What happens when MySQL adds a function with the same name as your own?

I use sha3 hashes in php (7.2) and I was going to continue using them in MySQL, but MySQL doesn't have support for them yet. If I write my own UDF and call it, say, sha3, but then some future MySQL version adds a native sha3 function, what…
Brian Leishman
  • 8,155
  • 11
  • 57
  • 93
3
votes
1 answer

Invoking an HTTP GET request through MySQL by executing native operating system's commands like curl

I am using MySQL 5.6.11 running on 32-bit Microsoft Windows XP (Professional Version 2002 Service Pack 3). I installed the MySQL sys_exec UDF. Since I am running on 32-bit Windows, I used this lib_mysqludf_sys.dll (placed under C:\Program…
Tiny
  • 27,221
  • 105
  • 339
  • 599
2
votes
1 answer

MySQL UDF for working with json?

Are there any good UDFs in MySQL to deal with json data, that supports the ability to retrieve a particular value in json (by dot notation key - EG: json_get('foo.bar.baz')) as well as the ability to set the value of a particular key - EG:…
archmeta
  • 1,107
  • 4
  • 17
  • 29
2
votes
1 answer

MySQL User Defined Functions in C++

I am trying to run MySQL UDF written in C++. It compiles fine and generates the correct output, but it generates a lot of junk after the output. I would like to know the reason for this junk and how I can resolve this problem? I have attached my…
Aman Vaishya
  • 179
  • 12
2
votes
0 answers

MySQL UDF That does a REGEX Search and Replace

Hello I'm a new web developer at open.uwec.edu. I recently had to switch over our web servers and have come across some challenges. Our old MySQL server used a function from the lib_mysqludf_preg library called preg_replace to do regular expression…
2
votes
1 answer

MySQL UDF sys_exec

I am using MySQL UDF function sys_exec for calling Java program inside a trigger of MySQL. Can you please provide me the information about how I pass argument to sys_exec so that it will call Java program?
Satish Sharma
  • 3,284
  • 9
  • 38
  • 51
1
vote
1 answer

How to debug/dump Go variable while building with cgo?

I'm trying to write a MySQL UDF in Go with cgo, in which I have a basic one functioning, but there's little bits and pieces that I can't figure out because I have no idea what some of the C variables are in terms of Go. This is an example that I…
Brian Leishman
  • 8,155
  • 11
  • 57
  • 93
1
vote
1 answer

preg_rlike not matching characters like ò , í , è etc

Can you hep me to match special characters like ò , í , è with mysql preg_rlike select first_name from authors where preg_rlike('/Jòse/i',authors.first_name); It will not retrieve data even if the database has value. We can handle this with LIKE…
Ha Dev
  • 93
  • 1
  • 7
1
vote
0 answers

How to get elements from an array returned from mysql udf

I created a mysql UDF that returns variable in char** type. The reason I did this is because I need to return two char arrays back to mysql at the same time. But I don't know how to get elements from this array when I build a mysql trigger that…
Saintycer
  • 47
  • 1
  • 2
  • 9
1
vote
1 answer

MySQL UDF Lib Install

I'm trying to install and use MySql UDF Lib but I'm facing an ELF error on its install procedure. I'm under Ubuntu 14.04LTS 64. Tried to follow some others answers and added -m64 flag for compiler, and still having the error. Disclaimer: I'm not…
GIJOW
  • 2,307
  • 1
  • 17
  • 37
1
vote
0 answers

Call WCF Service from MySQL Trigger

I have two databases on two different servers. I need to sync. data using service on the second server. The problem is I want to call this service from MySQL trigger. I have read this thread , this one and this one too but could not find it useful…
Asim Khan
  • 572
  • 6
  • 34
1
2