sys_eval() function. You can read the details here on his blog. Bernardo also created a similar function for PostgreSQL. Thank you, Bernardo!!!
sys_eval() is quite like sys_exec(): both functions can execute an arbitrary command string. The difference is that sys_eval() returns the output of the command, whereas sys_exec() returns the exit code. Go and check it out for yourself!






19 comments:
Roland,
I have a request for udf stat:
- a C version of quantile()
you could take a look to the code from the R quantile() function. It's already available in C and it's GPL code. - www.r-project.org
Daniele,
thanks for the seggestion!
I'll consider it, but I can't promise when I'll get round to it. I'll be leaving for a holiday not too far from now, might take a month before I get back on to this.
Of course, you could have a go at it yourself. The UDF inerface isn't that hard, and if the actual quantile code is already, well, perhaps you can cobble it up yourself, and I will be happy to include it in the udf stat package.
kind regards!
(don't hesitate to p.m. me in case you want to discuss the subject)
On a similar note, I wrote JsMap in my collection of UDFs. I mapped in SpiderMonkey to evaluate JavaScript. JsMap in my UDF collection
Jo Yo, that's great! At some point I had some experimental code to run js UDFs based on v8, it's great to see you have something released. Cool!
hi,
i am trying to compile for centos 5 (64 bits), but only get error, exists 64 bit compile version?
thanks for all
Hi javier,
I just created some code. AFAIC, there is nothing that keeps you from compiling it for a 64bit architecture.
You are not giving me enough information to determine what the problem is, so i am afraid I cannot help you.
On a 64Bit RedHat Linux ES i try to install lib_mysqludf_sys.so with Makefile Like this :
gcc -Wall -I/usr/include/mysql -Os -shared lib_mysqludf_sys.c -fPIC -o lib_mysqludf_sys.so
strip -sx lib_mysqludf_sys.so
cp -f lib_mysqludf_sys.so /usr/lib/lib_mysqludf_sys.so
Install seems to be good, after login root on mysql i obtain "can't open shared library 'lib_mysqludf_sys.so'"
Mysql 5.0.77 x86_64 redhat-linux-gnu
have you got an idea
Hi Guillaume!
what happens if you put the .so in the location where mysql's libraries are?
.so is already in /usr/lib/lib_mysqludf_sys.so
I use the Jmap makeFile, to add -fPIC option for compilation, and just change gcc-4... by gcc in command line
thanks for your reply
No, problem is not solved, i just said Hi, because i didn't does it before
Guillaume, do you have something like AppArmor? That is known to prevent sys_exec from running.
Sorry, But AppArmor is not installed on this server, and SElinux is disabled
Have you got an other Idea, where can i find an other UDF .so file to add a other function to Mysql or how can i debug make function
Guillaume,
sorry - I have no idea.
Guillaume,
Make sure you are also passing the -m64 flag to GCC to compile code for the 64bit arch.
Dear Sir;
I am using Red Hat ES 2.6.18-238.el5 #1 SMP Sun Dec 19 14:22:44 EST 2010 x86_64 x86_64 x86_64 GNU/Linux.
Project compiled successfully after adding two switches -fPIC and -m64 but not able to add UDF to mysql and getting below error.
After root password enter step.
ERROR 1126 (HY000) at line 29: Can't open shared library 'lib_mysqludf_sys.so' (errno: 22 lib_mysqludf_sys.so: wrong ELF class: ELFCLASS32)
ERROR: unable to install the UDF
64 useres compile it this way:
gcc -m64 -fPIC -Wall -I/usr/include/mysql -I. -shared lib_mysqludf_sys.c -o /usr/lib/lib_mysqludf_sys.so -L/usr/lib/x86_64-linux-gnu/libstdc++.so.6
Christian,
thanks for this contribution!
Hello all
Just want to add a new info:
I've followed the tip from Christian, to add the flag '-fPIC' inside the Makefile.
But, also, I had to change the destination directory from '/usr/lib/lib_mysqludf_sys.so' to '/usr/lib/mysql/plugin/lib_mysqludf_sys.so'
Anyway, thank you for the help.
Post a Comment