cubicweb/schemas/_regproc.mysql.sql
author Denis Laxalde <denis.laxalde@logilab.fr>
Wed, 08 Feb 2017 17:49:25 +0100
changeset 11957 48b8fbc88209
parent 11057 0b59724cb3f2
permissions -rw-r--r--
[server] Reprase messages of db-check to avoid using "system" and "sources" And rather mention "entity type table" and "entities" table, which are clearer references.

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