cubicweb/schemas/_regproc.mysql.sql
author Nicolas Chauvat <nicolas.chauvat@logilab.fr>
Fri, 15 Mar 2019 21:35:59 +0100
changeset 12884 9754c40c732a
parent 11057 0b59724cb3f2
permissions -rw-r--r--
[server] drop system_source_cnx for a simpler internal API system_source_cnx() can be replaced with source_cnx(). If system_source_cnx() is called with dbms_system_base=False, it is strictly equivalent to calling source_cnx() with the same source, privileges and interactivity. If system_source_cnx() is called with dbms_system_base=True, it is equivalent to calling source_cnx() with the system database and the same source, privileges and interactivity. No use of the default value for 'special_privs' was found in the code.

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