MT#55881 diff/15301.up: rename offset variable to support MariaDB >=10.6

Fixes:

| Applying revision script /usr/share/ngcp-db-schema/db_scripts/diff/15301.up: ERROR 1064 (42000) at line 14: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'offset int;
|     DECLARE chunk longblob;
|     DECLARE done int DEFAULT FALSE;
|
| ...' at line 4
| failed. :(

This is caused by MariaDB having "offset" as reserved word, quoting from
https://mariadb.com/kb/en/upgrading-from-mariadb-10-5-to-mariadb-10-6/:

| New reserved word: OFFSET. This can no longer be used as an identifier without being quoted.

Now that Debian/bookworm includes mariadb-server v10.6.10-1
we need to rename the variable.

Change-Id: I9db699ef60259411b8b79305f08179d4989edcd2
mr11.2
Michael Prokop 3 years ago
parent 2ac2b6b587
commit a9c1cf4cba

@ -14,7 +14,7 @@ DELIMITER ;;
CREATE PROCEDURE split_autoprov_firmware_data()
BEGIN
DECLARE n_fw_id, chunk_size, offset int;
DECLARE n_fw_id, chunk_size, off_set int;
DECLARE chunk longblob;
DECLARE done int DEFAULT FALSE;
@ -22,7 +22,7 @@ BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
SET chunk_size = 10485760;
SET offset = 1;
SET off_set = 1;
OPEN x;
x_main: LOOP
@ -30,15 +30,15 @@ BEGIN
IF done THEN
LEAVE x_main;
END IF;
SET offset = 1;
SET off_set = 1;
x_chunk: LOOP
SELECT substr(data, offset, chunk_size) INTO chunk
SELECT substr(data, off_set, chunk_size) INTO chunk
FROM autoprov_firmwares
WHERE id = n_fw_id;
IF LENGTH(chunk) > 0 THEN
INSERT INTO autoprov_firmwares_data (fw_id, data)
VALUES (n_fw_id, chunk);
SET offset = offset+chunk_size;
SET off_set = off_set+chunk_size;
ELSE
LEAVE x_chunk;
END IF;

Loading…
Cancel
Save