Skip to content

Commit c124be2

Browse files
authored
Disallow NULL values for location/beamline param to avoid NULL in DewarTransportHistory.storageLocation (#195)
1 parent 4165ae7 commit c124be2

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

schemas/ispyb/stored_programs/sp_update_container_assign.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ BEGIN
2121
DECLARE row_proposalNumber varchar(45) DEFAULT NULL;
2222
DECLARE row_queuedCount int(11) unsigned DEFAULT NULL;
2323

24+
IF p_beamline IS NULL THEN
25+
SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=1644, MESSAGE_TEXT='Mandatory argument p_beamline is NULL';
26+
END IF;
27+
2428
IF NOT (p_registry_barcode IS NULL) THEN
2529
START TRANSACTION;
2630

schemas/ispyb/stored_programs/sp_upsert_dewar.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ CREATE OR REPLACE PROCEDURE `upsert_dewar`(
2424
BEGIN
2525
DECLARE row_storageLocation varchar(45) DEFAULT NULL;
2626
DECLARE row_dewarStatus varchar(45) DEFAULT NULL;
27+
28+
IF p_storageLocation IS NULL THEN
29+
SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=1644, MESSAGE_TEXT='Mandatory argument p_storageLocation is NULL';
30+
END IF;
2731

2832
IF p_id IS NULL THEN
2933
IF p_type IS NOT NULL THEN

schemas/ispyb/stored_programs/sp_upsert_dewar_v2.sql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- Test:
22
-- SET @id = NULL;
3-
-- CALL upsert_dewar(@id, 'boaty', 6988, 'boatys dewar', NULL, '1', 'at facility', 0, 'DLS-MX-00101', NULL, 0, 0, NULL, NULL, 'Dewar', 'DLS-MX-00101', 5, NULL);
3+
-- CALL upsert_dewar_v2(@id, 'boaty', 6988, 'boatys dewar', NULL, '1', 'at facility', 0, 'DLS-MX-00101', NULL, 0, 0, NULL, NULL, 'Dewar', 'DLS-MX-00101', 5, NULL);
44
--
55

66
DELIMITER ;;
@@ -33,6 +33,10 @@ BEGIN
3333
DECLARE row_dewarStatus varchar(45) DEFAULT NULL;
3434
DECLARE row_count int unsigned DEFAULT 0;
3535

36+
IF p_storageLocation IS NULL THEN
37+
SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=1644, MESSAGE_TEXT='Mandatory argument p_storageLocation is NULL';
38+
END IF;
39+
3640
IF p_authLogin IS NOT NULL AND p_shippingId IS NOT NULL THEN
3741

3842
-- Authorise only if the person (p_authLogin) is a member of a session on the proposal of the shipping that the dewar belongs to.

0 commit comments

Comments
 (0)