schemas/_regproc.mysql.sql
author Christophe de Vienne <christophe@unlish.com>
Tue, 17 Jun 2014 11:53:35 +0200
changeset 9929 16163ee1cdf9
parent 3928 2ced335a9b55
permissions -rw-r--r--
[tests] Move 'anonymous_allowed' property from CubicWebServerTC to CubicWebTC The effective set of the property on the config is now done later that before, ie at the end of CubicWebTC.init_config instead of before. It is believed not to have an impact on the test suites that uses `anonymous_allowed`. Related to #4002134

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