schemas/_regproc.mysql.sql
author Pierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 31 Jul 2012 10:57:03 +0200
branchstable
changeset 8499 75abcdc94f4a
parent 3928 2ced335a9b55
permissions -rw-r--r--
[storage] relies on event=='deleted' to detect "delete" event When we delete a previously edited entity, it *will* have a cw_edited attribute even if the goal is to delete it. The function get an argument that explicitly contains the "delete" event. The code now uses that instead.

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