schemas/_regproc.mysql.sql
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 13 Sep 2011 17:42:22 +0200
branchstable
changeset 7787 d9607ae447d2
parent 3928 2ced335a9b55
permissions -rw-r--r--
[server] portable dump format supports now ZIP64 extensions by default (closes #1912535) ZIP files can use the ZIP64 extensions when the zipfile is larger than 2 GB. zipfile will raise an exception when the ZIP file would require ZIP64 extensions. Note: ZIP64 extensions are disabled by default in stdlib because the default zip and unzip commands on Unix (the InfoZIP utilities) don’t support these extensions.

/* -*- sql -*- 

   mysql specific registered procedures, 

*/

/* XXX limit_size version dealing with format as postgres version does.
   XXX mysql doesn't support overloading, each function should have a different name
       
   NOTE: fulltext renamed since it cause a mysql name conflict
 */

CREATE FUNCTION text_limit_size(vfulltext TEXT, maxsize INT)
RETURNS TEXT
NO SQL
BEGIN
    IF LENGTH(vfulltext) < maxsize THEN
       RETURN vfulltext;
    ELSE
       RETURN SUBSTRING(vfulltext from 1 for maxsize) || '...';
    END IF;
END ;;