schemas/_regproc.mysql.sql
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 21 Apr 2011 12:35:41 +0200
branchstable
changeset 7342 d1c8b5b3531c
parent 3928 2ced335a9b55
permissions -rw-r--r--
adds support for a portable db import/export format (closes: #1521112) the db-dump and db-restore cwctl commands are enhanced with a --format option (defaults to 'native'). If the format is 'portable', then the system database dump / restore is performed using pure SQL queries and the storage uses picked Python objects in a zip archive.

/* -*- 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 ;;