This commit is contained in:
parent
14ca5cc599
commit
a42723210f
|
@ -11,7 +11,7 @@ BEGIN
|
||||||
IF NEW.SUBCTA <=> '' THEN
|
IF NEW.SUBCTA <=> '' THEN
|
||||||
SET NEW.SUBCTA = NULL;
|
SET NEW.SUBCTA = NULL;
|
||||||
END IF;
|
END IF;
|
||||||
IF NEW.SUBCTA IS NOT NULL AND NOT util.checkStringLength(NEW.SUBCTA, 10) THEN
|
IF NEW.SUBCTA IS NOT NULL AND NOT LENGTH(NEW.SUBCTA) <=> 10 THEN
|
||||||
CALL util.throw('INVALID_STRING_LENGTH');
|
CALL util.throw('INVALID_STRING_LENGTH');
|
||||||
END IF;
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
|
@ -19,7 +19,7 @@ BEGIN
|
||||||
IF NEW.CONTRA <=> '' THEN
|
IF NEW.CONTRA <=> '' THEN
|
||||||
SET NEW.CONTRA = NULL;
|
SET NEW.CONTRA = NULL;
|
||||||
END IF;
|
END IF;
|
||||||
IF NEW.CONTRA IS NOT NULL AND NOT util.checkStringLength(NEW.CONTRA, 10) THEN
|
IF NEW.CONTRA IS NOT NULL AND NOT LENGTH(NEW.CONTRA) <=> 10 THEN
|
||||||
CALL util.throw('INVALID_STRING_LENGTH');
|
CALL util.throw('INVALID_STRING_LENGTH');
|
||||||
END IF;
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
|
@ -54,13 +54,13 @@ BEGIN
|
||||||
IF NEW.SUBCTA <=> '' THEN
|
IF NEW.SUBCTA <=> '' THEN
|
||||||
SET NEW.SUBCTA = NULL;
|
SET NEW.SUBCTA = NULL;
|
||||||
END IF;
|
END IF;
|
||||||
IF NEW.SUBCTA IS NOT NULL AND NOT util.checkStringLength(NEW.SUBCTA, 10) THEN
|
IF NEW.SUBCTA IS NOT NULL AND NOT LENGTH(NEW.SUBCTA) <=> 10 THEN
|
||||||
CALL util.throw('INVALID_STRING_LENGTH');
|
CALL util.throw('INVALID_STRING_LENGTH');
|
||||||
END IF;
|
END IF;
|
||||||
IF NEW.CONTRA <=> '' THEN
|
IF NEW.CONTRA <=> '' THEN
|
||||||
SET NEW.CONTRA = NULL;
|
SET NEW.CONTRA = NULL;
|
||||||
END IF;
|
END IF;
|
||||||
IF NEW.CONTRA IS NOT NULL AND NOT util.checkStringLength(NEW.CONTRA, 10) THEN
|
IF NEW.CONTRA IS NOT NULL AND NOT LENGTH(NEW.CONTRA) <=> 10 THEN
|
||||||
CALL util.throw('INVALID_STRING_LENGTH');
|
CALL util.throw('INVALID_STRING_LENGTH');
|
||||||
END IF;
|
END IF;
|
||||||
CALL XDiario_checkDate(NEW.FECHA);
|
CALL XDiario_checkDate(NEW.FECHA);
|
||||||
|
@ -71,22 +71,3 @@ BEGIN
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
||||||
|
|
||||||
DROP FUNCTION IF EXISTS `util`.`checkStringLength`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
$$
|
|
||||||
CREATE DEFINER=`root`@`localhost` FUNCTION `util`.`checkStringLength`(vString VARCHAR(255), vLength INT(3)) RETURNS tinyint(1)
|
|
||||||
DETERMINISTIC
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Comprueba la longitud de un string
|
|
||||||
*
|
|
||||||
* @param vString String a comprobar
|
|
||||||
* @param vLength Longitud que debe tener
|
|
||||||
* @return Devuelve TRUE/FALSE en caso de que tenga la longitud correcta o no
|
|
||||||
*/
|
|
||||||
RETURN LENGTH(vString) <=> vLength;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue