cubicweb/schemas/_regproc.mysql.sql
author Denis Laxalde <denis.laxalde@logilab.fr>
Thu, 02 Jun 2016 17:52:43 +0200
changeset 11286 0b38e373b985
parent 11057 0b59724cb3f2
permissions -rw-r--r--
[migration] Drop custom "readfunc" for code.interact in shell As the referenced bug http://bugs.python.org/issue1288615 got fixed in Python 2.6, this is no longer needed. Furthermore the implementation is not Python 3 compatible (raw_input, unicode).

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