schemas/_regproc.mysql.sql
author Julien Cristau <julien.cristau@logilab.fr>
Tue, 17 Jun 2014 11:56:38 +0200
changeset 9829 e0e71b45bf8d
parent 3928 2ced335a9b55
permissions -rw-r--r--
[migration] don't add new elements to config._cubes in remove_cube We're expanding dependencies based on the current versions of the cubes, which may well not be the same as the ones known by the db (we're in the middle of an upgrade, after all). Listing them in config._cubes prevents us from calling add_cube() later to actually add them. Closes #4002156

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