schemas/_regproc.mysql.sql
author Pierre-Yves David <pierre-yves.david@logilab.fr>
Fri, 14 Jun 2013 13:43:29 +0200
changeset 9019 e08f9c55dab5
parent 3928 2ced335a9b55
permissions -rw-r--r--
[application] call req.set_session in application.main_handle_request The Session handling chain is no more responsible for calling req.set_session. It just returns a valid session and lets the caller link it to the Request. This opens the way to explicitly creating and closing a connection/transaction in ``application.main_handle_request``. Related to #2503918

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