ERROR: Data too long for column 'x'

Talk and info about common issues and learn how to do almost anything with ApPHP Calendar

Moderator: alexandrleonenko

administrator
Site Admin
Site Admin
Posts: 6010
Joined: Jan 7th, '09, 23:18
Contact:

ERROR: Data too long for column 'x'

Postby administrator » Jun 1st, '11, 09:30

To fix this error, recreate stored procedures with increased length of returned string:

For example: define VARCHAR(2048) - currently it defined as 1024

Code: Select all

DROP FUNCTION IF EXISTS `apphp_text_encode`;

DELIMITER $$
CREATE FUNCTION  `apphp_text_encode` (x VARCHAR(1024))
   RETURNS varchar(1024) CHARSET utf8
      
   BEGIN
      DECLARE TextString VARCHAR(1024) ;
      SET TextString = x ;
      
      IF INSTR( x , '"' )
      THEN SET TextString = REPLACE(TextString, '"','"') ;
      END IF ;      
      IF INSTR( x , "'" )
      THEN SET TextString = REPLACE(TextString, "'",''') ;
      END IF ;      
      IF INSTR( x , "\\" )
      THEN SET TextString = REPLACE(TextString, "\\",'\') ;
      END IF ;      

      RETURN TextString ;    
   END$$
DELIMITER ;

Return to “ApPHP Calendar {HOW TO}”