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.databas e.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******@TheAI MSGroup.com> wrote in message
news:9v******** ***@FreeBSD.csi e.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_zli b.so"; CREATE FUNCTION uncompress_gz RETURNS STRING
SONAME
"mysqld_udf_zli b.so"; Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
mysql> select compress_gz('le ster');
+-----------------------+
| compress_gz('le ster') | +-----------------------+
| xËI-.I-a |
+-----------------------+
1 row in set (0.00 sec)
mysql> select uncompress_gz(c ompress_gz('les ter'));
+--------------------------------------+
| uncompress_gz(c ompress_gz('les ter')) | +--------------------------------------+
| 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.co m
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.mysq l.com>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php