schemas/_regproc.mysql.sql
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 24 Apr 2013 14:42:43 +0200
changeset 8943 58b3b2d9c965
parent 3928 2ced335a9b55
permissions -rw-r--r--
[repo] kill rebuildinfered feature from Repository.set_schema This clutters thing and is useless in most cases: when schema just have been readen from the database or from the file-system, infered relations have just be calculated. The only use-case where it should be rebuilt is on migration (ie schema modification by editing the meta-model using rql), so move this feature there.

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