solution myself. Long story short, I contacted Lester and ended up
writing an LZO solution just as Mark had mentioned below. Thought this
could also benifit someone out there so I'm reposting. Here's a link
to the source code:
http://www.servangle.net/udf_lzo/
BTW, Lester got his zlib implementation working as well. Hopefully
these will both be posted on MySQL website UDF section soon.
-John R.
--------------- original message ---------------
From: Mark Hazen (ma*************@hotmail.com)
Subject: Re: Mysql compress_gz()/uncompress_gz() user defined
functions
Newsgroups: mailing.database.mysql
Date: 2001-12-18 15:55:02 PST
I think this guy has made a noteworthy contribution. I've been
looking for
something like this for a while. Sure, there are ways to do it outside
of
MySQL but I always prefer working within MySQL. His function is great
for
storing big BLOB data that never needs to be searched on. I might add
this
suggestion though. Zlib compression is slow compared to LZO (search
LZO
compression on Google). Sure, Zlib isn't a dog and compresses better
than
LZO, but lzo is lightning fast for situations where the time to
compress is
very important. A function to compress_lzo and uncompress_lzo would
be
awesome.
Mark
"Lester Hightower" <hi******@TheAIMSGroup.com> wrote in message
news:9v***********@FreeBSD.csie.NCTU.edu.tw...
After sending my earlier email regarding compress_gz()/uncompress_gz() in
mysqld, I discovered user defined functions -- something I had never used
in mysqld until today.
So, I took a couple of hours and wrote a Mysql UDF to do what I requested:
# gcc -shared -DMYSQL_SERVER -DDEFAULT_MYSQL_HOME="\"/usr/local/mysql\""
-DDAT
ADIR="\"/usr/local/mysql/var\""
-DSHAREDIR="\"/usr/local/mysql/share/mysql\"
" -DHAVE_CONFIG_H -I./../include -I./../regex -I. -I../include -I..
-I. -I/u
sr/local/mysql/include -O3 -DDBUG_OFF -export-dynamic -fPIC
-fno-implicit-te
mplates -o mysqld_udf_zlib.so mysqld_udf_zlib.cc /usr/lib/libz.a
# cp ./mysqld_udf_zlib.so /usr/lib; ldconfig
# mysql mysql
mysql> CREATE FUNCTION compress_gz RETURNS STRING SONAME "mysqld_udf_zlib.so"; CREATE FUNCTION uncompress_gz RETURNS STRING
SONAME
"mysqld_udf_zlib.so"; Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
mysql> select compress_gz('lester');
+-----------------------+
| compress_gz('lester') | +-----------------------+
| xËI-.I-a |
+-----------------------+
1 row in set (0.00 sec)
mysql> select uncompress_gz(compress_gz('lester'));
+--------------------------------------+
| uncompress_gz(compress_gz('lester')) | +--------------------------------------+
| lester |
+--------------------------------------+
1 row in set (0.01 sec)
mysql> drop function compress_gz; drop function uncompress_gz;
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
It is late and I am going home for the evening. Tomorrow I will review
the code carefully, clean it up a bit, comment it well, and will then be
happy to contribute it to MySQL AB, if you guys are interested in having
it in the contributed software page. Is there a procedure for contribing
the code to you guys, or just email it to the mysql list, or what?
--
Lester H. Hightower TheAIMSGroup.com
Chief Technology Officer
The Advanced Integrated Management Solutions Group
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <my***************@lists.mysql.com>
To unsubscribe, e-mail <my**********************************************@ lists.mysql.com>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php