cubicweb/schemas/_regproc.mysql.sql
author Laurent Peuch <cortex@worlddomination.be>
Tue, 17 Dec 2019 16:56:23 +0100
changeset 12820 da416fb21657
parent 11057 0b59724cb3f2
permissions -rw-r--r--
[test/fix] prevent FirefoxHelper from silently failing to start This was breaking some tests without any obvious error message and you should fail as early as possible to make debugging easier. Closes #17260390

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