Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 161590e

Browse files
committed
Added MySQL UDF to execute commands on the underlying system:
* sys_eval() to return the standard output * sys_exec() to return the exit status It's a patched version of http://mysqludf.org/lib_mysqludf_sys/index.php
1 parent 6690b4c commit 161590e

8 files changed

Lines changed: 909 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
LIBDIR=/usr/lib
2+
3+
install:
4+
gcc -Wall -I/usr/include/mysql -I. -shared lib_mysqludf_sys.c -o $(LIBDIR)/lib_mysqludf_sys.so
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
echo "Compiling the MySQL UDF"
4+
make
5+
6+
if test $? -ne 0; then
7+
echo "ERROR: You need libmysqlclient development software installed "
8+
echo "to be able to compile this UDF, on Debian/Ubuntu just run:"
9+
echo "apt-get install libmysqlclient15-dev"
10+
exit 1
11+
else
12+
echo "MySQL UDF compiled successfully"
13+
fi
14+
15+
echo -e "\nPlease provide your MySQL root password and press RETURN: \c"
16+
read PASSWORD
17+
18+
mysql -u root --password=$PASSWORD mysql < lib_mysqludf_sys.sql
19+
20+
if test $? -ne 0; then
21+
echo "ERROR: unable to install the UDF"
22+
exit 1
23+
else
24+
echo "MySQL UDF installed successfully"
25+
fi

0 commit comments

Comments
 (0)