From c3b54582602c0766ecb1f2b89966425ad4771905 Mon Sep 17 00:00:00 2001 From: Patrick O'Shaughnessey Date: Sat, 14 Feb 2026 19:06:17 -0600 Subject: [PATCH 1/5] Fix stored procedure bugs blocking object creation and deletion - call_RMRoot_Event_RMCObject_Close: fix undefined variable twRMCObjectIx_Close (should be twRMCObjectIx), which caused all celestial scene deletion to fail - set_RMCObject_RMTObject_Open: remove DECLARE nResult that shadows OUT parameter, causing NULL return on terrestrial object creation under celestial parents - set_RMRoot_RMTObject_Open: same OUT parameter shadowing fix - set_RMTObject_RMTObject_Open: same OUT parameter shadowing fix - set_RMTObject_Transform: same OUT parameter shadowing fix --- .../RMRoot/call_RMRoot_Event_RMCObject_Close.sql | 2 +- MySQL/Procedures/RMRoot/set_RMRoot_RMTObject_Open.sql | 9 +++++---- .../RMTObject/set_RMTObject_RMTObject_Open.sql | 9 +++++---- .../Procedures/RMTObject/set_RMTObject_Transform.sql | 11 ++++++----- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/MySQL/Procedures/RMRoot/call_RMRoot_Event_RMCObject_Close.sql b/MySQL/Procedures/RMRoot/call_RMRoot_Event_RMCObject_Close.sql index aec603c..9deac4a 100644 --- a/MySQL/Procedures/RMRoot/call_RMRoot_Event_RMCObject_Close.sql +++ b/MySQL/Procedures/RMRoot/call_RMRoot_Event_RMCObject_Close.sql @@ -57,7 +57,7 @@ BEGIN IF bError = 0 THEN - CALL call_RMCObject_Delete_Descendants (twRMCObjectIx_Close, bError); + CALL call_RMCObject_Delete_Descendants (twRMCObjectIx, bError); END IF ; IF bError = 0 diff --git a/MySQL/Procedures/RMRoot/set_RMRoot_RMTObject_Open.sql b/MySQL/Procedures/RMRoot/set_RMRoot_RMTObject_Open.sql index ebaddf6..93d6324 100644 --- a/MySQL/Procedures/RMRoot/set_RMRoot_RMTObject_Open.sql +++ b/MySQL/Procedures/RMRoot/set_RMRoot_RMTObject_Open.sql @@ -69,6 +69,7 @@ BEGIN DECLARE nError INT DEFAULT 0; DECLARE bCommit INT DEFAULT 0; DECLARE bError INT; + DECLARE nMatrixResult INT; DECLARE ObjectHead_Parent_wClass SMALLINT; DECLARE ObjectHead_Parent_twObjectIx BIGINT; @@ -139,16 +140,16 @@ BEGIN THEN IF bCoord = 3 -- RMTMATRIX_COORD_NUL THEN - CALL call_RMTMatrix_Nul (SBO_CLASS_RMROOT, twRMRootIx, twRMTObjectIx_Open, Transform_Position_dX, Transform_Position_dY, Transform_Position_dZ, Transform_Rotation_dX, Transform_Rotation_dY, Transform_Rotation_dZ, Transform_Rotation_dW, Transform_Scale_dX, Transform_Scale_dY, Transform_Scale_dZ, nResult); + CALL call_RMTMatrix_Nul (SBO_CLASS_RMROOT, twRMRootIx, twRMTObjectIx_Open, Transform_Position_dX, Transform_Position_dY, Transform_Position_dZ, Transform_Rotation_dX, Transform_Rotation_dY, Transform_Rotation_dZ, Transform_Rotation_dW, Transform_Scale_dX, Transform_Scale_dY, Transform_Scale_dZ, nMatrixResult); ELSEIF bCoord = 2 -- RMTMATRIX_COORD_CAR THEN - CALL call_RMTMatrix_Car (twRMTObjectIx_Open, dA, dB, dC, nResult); + CALL call_RMTMatrix_Car (twRMTObjectIx_Open, dA, dB, dC, nMatrixResult); ELSEIF bCoord = 1 -- RMTMATRIX_COORD_CYL THEN - CALL call_RMTMatrix_Cyl (twRMTObjectIx_Open, dA, dB, dC, nResult); + CALL call_RMTMatrix_Cyl (twRMTObjectIx_Open, dA, dB, dC, nMatrixResult); ELSEIF bCoord = 0 -- RMTMATRIX_COORD_GEO THEN - CALL call_RMTMatrix_Geo (twRMTObjectIx_Open, dA, dB, dC, nResult); + CALL call_RMTMatrix_Geo (twRMTObjectIx_Open, dA, dB, dC, nMatrixResult); END IF ; CALL call_RMTMatrix_Relative (SBO_CLASS_RMROOT, twRMRootIx, twRMTObjectIx_Open); diff --git a/MySQL/Procedures/RMTObject/set_RMTObject_RMTObject_Open.sql b/MySQL/Procedures/RMTObject/set_RMTObject_RMTObject_Open.sql index fee4316..5c2e0cf 100644 --- a/MySQL/Procedures/RMTObject/set_RMTObject_RMTObject_Open.sql +++ b/MySQL/Procedures/RMTObject/set_RMTObject_RMTObject_Open.sql @@ -69,6 +69,7 @@ BEGIN DECLARE nError INT DEFAULT 0; DECLARE bCommit INT DEFAULT 0; DECLARE bError INT; + DECLARE nMatrixResult INT; DECLARE ObjectHead_Parent_wClass SMALLINT; DECLARE ObjectHead_Parent_twObjectIx BIGINT; @@ -139,16 +140,16 @@ BEGIN THEN IF bCoord = 3 -- RMTMATRIX_COORD_NUL THEN - CALL call_RMTMatrix_Nul (SBO_CLASS_RMTOBJECT, twRMTObjectIx, twRMTObjectIx_Open, Transform_Position_dX, Transform_Position_dY, Transform_Position_dZ, Transform_Rotation_dX, Transform_Rotation_dY, Transform_Rotation_dZ, Transform_Rotation_dW, Transform_Scale_dX, Transform_Scale_dY, Transform_Scale_dZ, nResult); + CALL call_RMTMatrix_Nul (SBO_CLASS_RMTOBJECT, twRMTObjectIx, twRMTObjectIx_Open, Transform_Position_dX, Transform_Position_dY, Transform_Position_dZ, Transform_Rotation_dX, Transform_Rotation_dY, Transform_Rotation_dZ, Transform_Rotation_dW, Transform_Scale_dX, Transform_Scale_dY, Transform_Scale_dZ, nMatrixResult); ELSEIF bCoord = 2 -- RMTMATRIX_COORD_CAR THEN - CALL call_RMTMatrix_Car (twRMTObjectIx_Open, dA, dB, dC, nResult); + CALL call_RMTMatrix_Car (twRMTObjectIx_Open, dA, dB, dC, nMatrixResult); ELSEIF bCoord = 1 -- RMTMATRIX_COORD_CYL THEN - CALL call_RMTMatrix_Cyl (twRMTObjectIx_Open, dA, dB, dC, nResult); + CALL call_RMTMatrix_Cyl (twRMTObjectIx_Open, dA, dB, dC, nMatrixResult); ELSEIF bCoord = 0 -- RMTMATRIX_COORD_GEO THEN - CALL call_RMTMatrix_Geo (twRMTObjectIx_Open, dA, dB, dC, nResult); + CALL call_RMTMatrix_Geo (twRMTObjectIx_Open, dA, dB, dC, nMatrixResult); END IF ; CALL call_RMTMatrix_Relative (SBO_CLASS_RMTOBJECT, twRMTObjectIx, twRMTObjectIx_Open); diff --git a/MySQL/Procedures/RMTObject/set_RMTObject_Transform.sql b/MySQL/Procedures/RMTObject/set_RMTObject_Transform.sql index 365a926..4a66098 100644 --- a/MySQL/Procedures/RMTObject/set_RMTObject_Transform.sql +++ b/MySQL/Procedures/RMTObject/set_RMTObject_Transform.sql @@ -53,7 +53,8 @@ BEGIN DECLARE nError INT DEFAULT 0; DECLARE bCommit INT DEFAULT 0; DECLARE bError INT; - + DECLARE nMatrixResult INT; + DECLARE ObjectHead_Parent_wClass SMALLINT; DECLARE ObjectHead_Parent_twObjectIx BIGINT; @@ -126,16 +127,16 @@ BEGIN IF bCoord = 3 -- RMTMATRIX_COORD_NUL THEN - CALL call_RMTMatrix_Nul (ObjectHead_Parent_wClass, ObjectHead_Parent_twObjectIx, twRMTObjectIx, Transform_Position_dX, Transform_Position_dY, Transform_Position_dZ, Transform_Rotation_dX, Transform_Rotation_dY, Transform_Rotation_dZ, Transform_Rotation_dW, Transform_Scale_dX, Transform_Scale_dY, Transform_Scale_dZ, nResult); + CALL call_RMTMatrix_Nul (ObjectHead_Parent_wClass, ObjectHead_Parent_twObjectIx, twRMTObjectIx, Transform_Position_dX, Transform_Position_dY, Transform_Position_dZ, Transform_Rotation_dX, Transform_Rotation_dY, Transform_Rotation_dZ, Transform_Rotation_dW, Transform_Scale_dX, Transform_Scale_dY, Transform_Scale_dZ, nMatrixResult); ELSEIF bCoord = 2 -- RMTMATRIX_COORD_CAR THEN - CALL call_RMTMatrix_Car (twRMTObjectIx, dA, dB, dC, nResult); + CALL call_RMTMatrix_Car (twRMTObjectIx, dA, dB, dC, nMatrixResult); ELSEIF bCoord = 1 -- RMTMATRIX_COORD_CYL THEN - CALL call_RMTMatrix_Cyl (twRMTObjectIx, dA, dB, dC, nResult); + CALL call_RMTMatrix_Cyl (twRMTObjectIx, dA, dB, dC, nMatrixResult); ELSEIF bCoord = 0 -- RMTMATRIX_COORD_GEO THEN - CALL call_RMTMatrix_Geo (twRMTObjectIx, dA, dB, dC, nResult); + CALL call_RMTMatrix_Geo (twRMTObjectIx, dA, dB, dC, nMatrixResult); END IF ; CALL call_RMTMatrix_Relative(ObjectHead_Parent_wClass, ObjectHead_Parent_twObjectIx, twRMTObjectIx); From a260654b38d3122b868b86d4210e1eaf7020be10 Mon Sep 17 00:00:00 2001 From: Patrick O'Shaughnessey Date: Tue, 21 Apr 2026 18:21:41 -0500 Subject: [PATCH 2/5] Fix OUT parameter shadowing in set_RMCObject_RMTObject_Open Complete the fix described in c3b5458's commit message, which listed this file but didn't include its changes. Applies the same nMatrixResult treatment used in the sibling RMTObject_Open / Transform procs so matrix subcall return codes don't stomp the outer procedure's OUT parameter. --- .../RMCObject/set_RMCObject_RMTObject_Open.sql | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/MySQL/Procedures/RMCObject/set_RMCObject_RMTObject_Open.sql b/MySQL/Procedures/RMCObject/set_RMCObject_RMTObject_Open.sql index e904ede..66a7a87 100644 --- a/MySQL/Procedures/RMCObject/set_RMCObject_RMTObject_Open.sql +++ b/MySQL/Procedures/RMCObject/set_RMCObject_RMTObject_Open.sql @@ -69,6 +69,7 @@ BEGIN DECLARE nError INT DEFAULT 0; DECLARE bCommit INT DEFAULT 0; DECLARE bError INT; + DECLARE nMatrixResult INT; DECLARE ObjectHead_Parent_wClass SMALLINT; DECLARE ObjectHead_Parent_twObjectIx BIGINT; @@ -139,16 +140,16 @@ BEGIN THEN IF bCoord = 3 -- RMTMATRIX_COORD_NUL THEN - CALL call_RMTMatrix_Nul (SBO_CLASS_RMCOBJECT, twRMCObjectIx, twRMTObjectIx_Open, Transform_Position_dX, Transform_Position_dY, Transform_Position_dZ, Transform_Rotation_dX, Transform_Rotation_dY, Transform_Rotation_dZ, Transform_Rotation_dW, Transform_Scale_dX, Transform_Scale_dY, Transform_Scale_dZ, nResult); + CALL call_RMTMatrix_Nul (SBO_CLASS_RMCOBJECT, twRMCObjectIx, twRMTObjectIx_Open, Transform_Position_dX, Transform_Position_dY, Transform_Position_dZ, Transform_Rotation_dX, Transform_Rotation_dY, Transform_Rotation_dZ, Transform_Rotation_dW, Transform_Scale_dX, Transform_Scale_dY, Transform_Scale_dZ, nMatrixResult); ELSEIF bCoord = 2 -- RMTMATRIX_COORD_CAR THEN - CALL call_RMTMatrix_Car (twRMTObjectIx_Open, dA, dB, dC, nResult); + CALL call_RMTMatrix_Car (twRMTObjectIx_Open, dA, dB, dC, nMatrixResult); ELSEIF bCoord = 1 -- RMTMATRIX_COORD_CYL THEN - CALL call_RMTMatrix_Cyl (twRMTObjectIx_Open, dA, dB, dC, nResult); + CALL call_RMTMatrix_Cyl (twRMTObjectIx_Open, dA, dB, dC, nMatrixResult); ELSEIF bCoord = 0 -- RMTMATRIX_COORD_GEO THEN - CALL call_RMTMatrix_Geo (twRMTObjectIx_Open, dA, dB, dC, nResult); + CALL call_RMTMatrix_Geo (twRMTObjectIx_Open, dA, dB, dC, nMatrixResult); END IF ; CALL call_RMTMatrix_Relative (SBO_CLASS_RMCOBJECT, twRMCObjectIx, twRMTObjectIx_Open); From 5195b24507ecd4499cc650d6f35509add0bf77bf Mon Sep 17 00:00:00 2001 From: Patrick O'Shaughnessey Date: Wed, 22 Apr 2026 16:11:15 -0500 Subject: [PATCH 3/5] Correct call_RMRoot_Event_RMCObject_Close and revert superfluous _Open changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reverts the nMatrixResult additions in the four _Open/Transform procs (c3b5458 + a260654) — those were surgical against the pre-79c33e5 shadowing-DECLARE state; upstream dropped the shadow DECLARE directly in 79c33e5 and rerouting matrix subcalls through a second local variable no longer addresses any bug. Reverts the c3b5458 line 60 change in call_RMRoot_Event_RMCObject_Close (which upstream's 79c33e5 made valid by renaming the IN param). Applies the actual remaining bug: line 82 of the same proc still referenced the pre-rename identifier twRMCObjectIx, which is undefined in the current scope. Changes it to the post-rename IN parameter twRMCObjectIx_Close. Mirrors the SQL Server version of the same proc, which uses @twRMCObjectIx_Close at the equivalent position. --- .../RMCObject/set_RMCObject_RMTObject_Open.sql | 9 ++++----- .../RMRoot/call_RMRoot_Event_RMCObject_Close.sql | 4 ++-- MySQL/Procedures/RMRoot/set_RMRoot_RMTObject_Open.sql | 9 ++++----- .../RMTObject/set_RMTObject_RMTObject_Open.sql | 9 ++++----- .../Procedures/RMTObject/set_RMTObject_Transform.sql | 11 +++++------ 5 files changed, 19 insertions(+), 23 deletions(-) diff --git a/MySQL/Procedures/RMCObject/set_RMCObject_RMTObject_Open.sql b/MySQL/Procedures/RMCObject/set_RMCObject_RMTObject_Open.sql index 66a7a87..e904ede 100644 --- a/MySQL/Procedures/RMCObject/set_RMCObject_RMTObject_Open.sql +++ b/MySQL/Procedures/RMCObject/set_RMCObject_RMTObject_Open.sql @@ -69,7 +69,6 @@ BEGIN DECLARE nError INT DEFAULT 0; DECLARE bCommit INT DEFAULT 0; DECLARE bError INT; - DECLARE nMatrixResult INT; DECLARE ObjectHead_Parent_wClass SMALLINT; DECLARE ObjectHead_Parent_twObjectIx BIGINT; @@ -140,16 +139,16 @@ BEGIN THEN IF bCoord = 3 -- RMTMATRIX_COORD_NUL THEN - CALL call_RMTMatrix_Nul (SBO_CLASS_RMCOBJECT, twRMCObjectIx, twRMTObjectIx_Open, Transform_Position_dX, Transform_Position_dY, Transform_Position_dZ, Transform_Rotation_dX, Transform_Rotation_dY, Transform_Rotation_dZ, Transform_Rotation_dW, Transform_Scale_dX, Transform_Scale_dY, Transform_Scale_dZ, nMatrixResult); + CALL call_RMTMatrix_Nul (SBO_CLASS_RMCOBJECT, twRMCObjectIx, twRMTObjectIx_Open, Transform_Position_dX, Transform_Position_dY, Transform_Position_dZ, Transform_Rotation_dX, Transform_Rotation_dY, Transform_Rotation_dZ, Transform_Rotation_dW, Transform_Scale_dX, Transform_Scale_dY, Transform_Scale_dZ, nResult); ELSEIF bCoord = 2 -- RMTMATRIX_COORD_CAR THEN - CALL call_RMTMatrix_Car (twRMTObjectIx_Open, dA, dB, dC, nMatrixResult); + CALL call_RMTMatrix_Car (twRMTObjectIx_Open, dA, dB, dC, nResult); ELSEIF bCoord = 1 -- RMTMATRIX_COORD_CYL THEN - CALL call_RMTMatrix_Cyl (twRMTObjectIx_Open, dA, dB, dC, nMatrixResult); + CALL call_RMTMatrix_Cyl (twRMTObjectIx_Open, dA, dB, dC, nResult); ELSEIF bCoord = 0 -- RMTMATRIX_COORD_GEO THEN - CALL call_RMTMatrix_Geo (twRMTObjectIx_Open, dA, dB, dC, nMatrixResult); + CALL call_RMTMatrix_Geo (twRMTObjectIx_Open, dA, dB, dC, nResult); END IF ; CALL call_RMTMatrix_Relative (SBO_CLASS_RMCOBJECT, twRMCObjectIx, twRMTObjectIx_Open); diff --git a/MySQL/Procedures/RMRoot/call_RMRoot_Event_RMCObject_Close.sql b/MySQL/Procedures/RMRoot/call_RMRoot_Event_RMCObject_Close.sql index 9deac4a..a42b38b 100644 --- a/MySQL/Procedures/RMRoot/call_RMRoot_Event_RMCObject_Close.sql +++ b/MySQL/Procedures/RMRoot/call_RMRoot_Event_RMCObject_Close.sql @@ -57,7 +57,7 @@ BEGIN IF bError = 0 THEN - CALL call_RMCObject_Delete_Descendants (twRMCObjectIx, bError); + CALL call_RMCObject_Delete_Descendants (twRMCObjectIx_Close, bError); END IF ; IF bError = 0 @@ -79,7 +79,7 @@ BEGIN SBO_CLASS_RMROOT, twRMRootIx, SBO_CLASS_RMCOBJECT, - twRMCObjectIx, + twRMCObjectIx_Close, SUBSCRIBE_REFRESH_EVENT_EX_FLAG_CLOSE, twEventIz, diff --git a/MySQL/Procedures/RMRoot/set_RMRoot_RMTObject_Open.sql b/MySQL/Procedures/RMRoot/set_RMRoot_RMTObject_Open.sql index 93d6324..ebaddf6 100644 --- a/MySQL/Procedures/RMRoot/set_RMRoot_RMTObject_Open.sql +++ b/MySQL/Procedures/RMRoot/set_RMRoot_RMTObject_Open.sql @@ -69,7 +69,6 @@ BEGIN DECLARE nError INT DEFAULT 0; DECLARE bCommit INT DEFAULT 0; DECLARE bError INT; - DECLARE nMatrixResult INT; DECLARE ObjectHead_Parent_wClass SMALLINT; DECLARE ObjectHead_Parent_twObjectIx BIGINT; @@ -140,16 +139,16 @@ BEGIN THEN IF bCoord = 3 -- RMTMATRIX_COORD_NUL THEN - CALL call_RMTMatrix_Nul (SBO_CLASS_RMROOT, twRMRootIx, twRMTObjectIx_Open, Transform_Position_dX, Transform_Position_dY, Transform_Position_dZ, Transform_Rotation_dX, Transform_Rotation_dY, Transform_Rotation_dZ, Transform_Rotation_dW, Transform_Scale_dX, Transform_Scale_dY, Transform_Scale_dZ, nMatrixResult); + CALL call_RMTMatrix_Nul (SBO_CLASS_RMROOT, twRMRootIx, twRMTObjectIx_Open, Transform_Position_dX, Transform_Position_dY, Transform_Position_dZ, Transform_Rotation_dX, Transform_Rotation_dY, Transform_Rotation_dZ, Transform_Rotation_dW, Transform_Scale_dX, Transform_Scale_dY, Transform_Scale_dZ, nResult); ELSEIF bCoord = 2 -- RMTMATRIX_COORD_CAR THEN - CALL call_RMTMatrix_Car (twRMTObjectIx_Open, dA, dB, dC, nMatrixResult); + CALL call_RMTMatrix_Car (twRMTObjectIx_Open, dA, dB, dC, nResult); ELSEIF bCoord = 1 -- RMTMATRIX_COORD_CYL THEN - CALL call_RMTMatrix_Cyl (twRMTObjectIx_Open, dA, dB, dC, nMatrixResult); + CALL call_RMTMatrix_Cyl (twRMTObjectIx_Open, dA, dB, dC, nResult); ELSEIF bCoord = 0 -- RMTMATRIX_COORD_GEO THEN - CALL call_RMTMatrix_Geo (twRMTObjectIx_Open, dA, dB, dC, nMatrixResult); + CALL call_RMTMatrix_Geo (twRMTObjectIx_Open, dA, dB, dC, nResult); END IF ; CALL call_RMTMatrix_Relative (SBO_CLASS_RMROOT, twRMRootIx, twRMTObjectIx_Open); diff --git a/MySQL/Procedures/RMTObject/set_RMTObject_RMTObject_Open.sql b/MySQL/Procedures/RMTObject/set_RMTObject_RMTObject_Open.sql index 5c2e0cf..fee4316 100644 --- a/MySQL/Procedures/RMTObject/set_RMTObject_RMTObject_Open.sql +++ b/MySQL/Procedures/RMTObject/set_RMTObject_RMTObject_Open.sql @@ -69,7 +69,6 @@ BEGIN DECLARE nError INT DEFAULT 0; DECLARE bCommit INT DEFAULT 0; DECLARE bError INT; - DECLARE nMatrixResult INT; DECLARE ObjectHead_Parent_wClass SMALLINT; DECLARE ObjectHead_Parent_twObjectIx BIGINT; @@ -140,16 +139,16 @@ BEGIN THEN IF bCoord = 3 -- RMTMATRIX_COORD_NUL THEN - CALL call_RMTMatrix_Nul (SBO_CLASS_RMTOBJECT, twRMTObjectIx, twRMTObjectIx_Open, Transform_Position_dX, Transform_Position_dY, Transform_Position_dZ, Transform_Rotation_dX, Transform_Rotation_dY, Transform_Rotation_dZ, Transform_Rotation_dW, Transform_Scale_dX, Transform_Scale_dY, Transform_Scale_dZ, nMatrixResult); + CALL call_RMTMatrix_Nul (SBO_CLASS_RMTOBJECT, twRMTObjectIx, twRMTObjectIx_Open, Transform_Position_dX, Transform_Position_dY, Transform_Position_dZ, Transform_Rotation_dX, Transform_Rotation_dY, Transform_Rotation_dZ, Transform_Rotation_dW, Transform_Scale_dX, Transform_Scale_dY, Transform_Scale_dZ, nResult); ELSEIF bCoord = 2 -- RMTMATRIX_COORD_CAR THEN - CALL call_RMTMatrix_Car (twRMTObjectIx_Open, dA, dB, dC, nMatrixResult); + CALL call_RMTMatrix_Car (twRMTObjectIx_Open, dA, dB, dC, nResult); ELSEIF bCoord = 1 -- RMTMATRIX_COORD_CYL THEN - CALL call_RMTMatrix_Cyl (twRMTObjectIx_Open, dA, dB, dC, nMatrixResult); + CALL call_RMTMatrix_Cyl (twRMTObjectIx_Open, dA, dB, dC, nResult); ELSEIF bCoord = 0 -- RMTMATRIX_COORD_GEO THEN - CALL call_RMTMatrix_Geo (twRMTObjectIx_Open, dA, dB, dC, nMatrixResult); + CALL call_RMTMatrix_Geo (twRMTObjectIx_Open, dA, dB, dC, nResult); END IF ; CALL call_RMTMatrix_Relative (SBO_CLASS_RMTOBJECT, twRMTObjectIx, twRMTObjectIx_Open); diff --git a/MySQL/Procedures/RMTObject/set_RMTObject_Transform.sql b/MySQL/Procedures/RMTObject/set_RMTObject_Transform.sql index 4a66098..365a926 100644 --- a/MySQL/Procedures/RMTObject/set_RMTObject_Transform.sql +++ b/MySQL/Procedures/RMTObject/set_RMTObject_Transform.sql @@ -53,8 +53,7 @@ BEGIN DECLARE nError INT DEFAULT 0; DECLARE bCommit INT DEFAULT 0; DECLARE bError INT; - DECLARE nMatrixResult INT; - + DECLARE ObjectHead_Parent_wClass SMALLINT; DECLARE ObjectHead_Parent_twObjectIx BIGINT; @@ -127,16 +126,16 @@ BEGIN IF bCoord = 3 -- RMTMATRIX_COORD_NUL THEN - CALL call_RMTMatrix_Nul (ObjectHead_Parent_wClass, ObjectHead_Parent_twObjectIx, twRMTObjectIx, Transform_Position_dX, Transform_Position_dY, Transform_Position_dZ, Transform_Rotation_dX, Transform_Rotation_dY, Transform_Rotation_dZ, Transform_Rotation_dW, Transform_Scale_dX, Transform_Scale_dY, Transform_Scale_dZ, nMatrixResult); + CALL call_RMTMatrix_Nul (ObjectHead_Parent_wClass, ObjectHead_Parent_twObjectIx, twRMTObjectIx, Transform_Position_dX, Transform_Position_dY, Transform_Position_dZ, Transform_Rotation_dX, Transform_Rotation_dY, Transform_Rotation_dZ, Transform_Rotation_dW, Transform_Scale_dX, Transform_Scale_dY, Transform_Scale_dZ, nResult); ELSEIF bCoord = 2 -- RMTMATRIX_COORD_CAR THEN - CALL call_RMTMatrix_Car (twRMTObjectIx, dA, dB, dC, nMatrixResult); + CALL call_RMTMatrix_Car (twRMTObjectIx, dA, dB, dC, nResult); ELSEIF bCoord = 1 -- RMTMATRIX_COORD_CYL THEN - CALL call_RMTMatrix_Cyl (twRMTObjectIx, dA, dB, dC, nMatrixResult); + CALL call_RMTMatrix_Cyl (twRMTObjectIx, dA, dB, dC, nResult); ELSEIF bCoord = 0 -- RMTMATRIX_COORD_GEO THEN - CALL call_RMTMatrix_Geo (twRMTObjectIx, dA, dB, dC, nMatrixResult); + CALL call_RMTMatrix_Geo (twRMTObjectIx, dA, dB, dC, nResult); END IF ; CALL call_RMTMatrix_Relative(ObjectHead_Parent_wClass, ObjectHead_Parent_twObjectIx, twRMTObjectIx); From a5d84a3c72569cdbbc3f59c6863f8e51e2248ca5 Mon Sep 17 00:00:00 2001 From: Patrick O'Shaughnessey Date: Mon, 4 May 2026 19:55:39 -0500 Subject: [PATCH 4/5] Fix swapped d22/d23 in call_RMTMatrix_Relative ELSE branch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ELSE branch (taken when the parent is not an RMTObject — i.e. for sectors directly under root) used a `SELECT ... INTO ...` pattern with `mr.d23` and `mr.d22` listed in the wrong order against the `d20, d21, d22, d23` INTO list. In MySQL, `SELECT ... INTO ...` is positional, so this silently assigned local `d22 := mr.d23` and `d23 := mr.d22`. The matrix-to-transform extraction then computed `Transform_Scale_dZ = SQRT(... d22²) = 0` and `Transform_Position_dZ = d23` from the wrong column, persisting `scale.z = 0` and `position.z = ` to the RMTObject row even though the underlying matrix was correct. Reads from the row returned the corrupt values; subscriptions propagated them to clients. The SQL Server version had the same out-of-order textual layout but the syntax there is `@var = column` (assignment by name, not position), so it was cosmetic only. Fix both for consistency so the parallel MySQL bug isn't reintroduced by copying the SQL Server pattern. Verified on a live database: a sector whose row had been corrupted self-healed to the correct values on the next transform update after the procedure was reloaded. --- MySQL/Procedures/RMTMatrix/call_RMTMatrix_Relative.sql | 2 +- SQL_Server/Procedures/RMTMatrix/call_RMTMatrix_Relative.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MySQL/Procedures/RMTMatrix/call_RMTMatrix_Relative.sql b/MySQL/Procedures/RMTMatrix/call_RMTMatrix_Relative.sql index cfe9314..6c96482 100644 --- a/MySQL/Procedures/RMTMatrix/call_RMTMatrix_Relative.sql +++ b/MySQL/Procedures/RMTMatrix/call_RMTMatrix_Relative.sql @@ -91,8 +91,8 @@ BEGIN mr.d20, mr.d21, - mr.d23, mr.d22, + mr.d23, mr.d30, mr.d31, diff --git a/SQL_Server/Procedures/RMTMatrix/call_RMTMatrix_Relative.sql b/SQL_Server/Procedures/RMTMatrix/call_RMTMatrix_Relative.sql index ac26aaf..73135d8 100644 --- a/SQL_Server/Procedures/RMTMatrix/call_RMTMatrix_Relative.sql +++ b/SQL_Server/Procedures/RMTMatrix/call_RMTMatrix_Relative.sql @@ -86,8 +86,8 @@ BEGIN @d20 = mr.d20, @d21 = mr.d21, - @d23 = mr.d23, @d22 = mr.d22, + @d23 = mr.d23, @d30 = mr.d30, @d31 = mr.d31, From 160f6ad806193adad1efa91fa88b64c0634ad5c9 Mon Sep 17 00:00:00 2001 From: Patrick O'Shaughnessey Date: Thu, 7 May 2026 16:08:19 -0500 Subject: [PATCH 5/5] Fix MySQL search_RMTObject and search_RMCObject end-to-end Four related bugs prevented every RMTObject:search and RMCObject:search call from succeeding on MySQL deployments. This commit fixes all four at the source level so neither proc requires special sql_mode or session collation at deploy time. 1. PARAM-COUNT MISMATCH (caught at protocol layer) The MSF node framework calls every proc with the form: CALL (sIPAddress, twRPersonaIx, ...aData..., @result); SELECT @result AS result; That's 2 + len(aData) + 1 = 8 args for these search procs. Both procs were declared with 7 IN params and 0 OUT params, so MySQL rejected every CALL: 'Incorrect number of arguments for PROCEDURE .search_RMTObject; expected 7, got 8' (mysql2 errno 1050, sqlState 42S01). Fix: add OUT nResult BIGINT to both procs (matches the convention used by every other MySQL get_*/set_* proc in this repo) and set nResult at the end with the canonical formula 'SET nResult = bCommit - 1 - nError;' In search_RMCObject, replace the dead 'SET nError = bCommit - bError - 1;' line (assigned to a local nothing reads, clearly meant to be the missing OUT assignment) with the canonical nResult assignment. 2. bError NULL INIT (would prevent success path even after #1) Both procs declared 'bError INT' without a DEFAULT, so bError started as NULL. The expression 'IF bError = 0' then evaluated to NULL (falsy in MySQL), which means the success branch was unreachable on the happy path: every call would have fallen through to call_Error ('twRMTObjectIx is invalid' / 'twRMCObjectIx is invalid') even with valid input. SQL_Server versions already declared @bError with 'INT = 0', so this was MySQL-only. Fix: add 'DEFAULT 0' to bError declaration in both procs, matching the adjacent bCommit / nError declarations and the SQL_Server convention. Also added DEFAULT 0 to nError in search_RMTObject for consistency (search_RMCObject already had it). 3. TRIM ( with space requires IGNORE_SPACE in sql_mode (would prevent body execution after #1 and #2 unless deploy-time sql_mode set) The proc body had 'TRIM (IFNULL (sText, ''))' (note the space after TRIM). Without IGNORE_SPACE in the routine's stored sql_mode, MySQL parses 'TRIM (' as a user-defined function call, and the CALL fails at runtime with 'ERROR 1630: FUNCTION .TRIM does not exist'. This made deployment of the procs sql_mode-dependent. Fix: remove the space in TRIM and IFNULL: 'TRIM(IFNULL(sText, ''))'. Now the proc parses correctly under any sql_mode. (Other functions like POW (, IF (, CONCAT(, ArcLength ( do not have this issue and were left unchanged for minimal diff.) 4. COLLATION MISMATCH ON LIKE (would prevent body execution after #1 #2 #3 unless DB default collation matches column collation) The proc body did 'WHERE o.Name_wsRMTObjectId LIKE CONCAT(sText, '%')'. The column's collation is utf8mb4_unicode_ci (declared on the table) while the parameter sText inherits the database's DEFAULT_COLLATION (typically utf8mb4_0900_ai_ci on MySQL 8). Mixing two IMPLICIT collations of different names raises 'ERROR 1267: Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_0900_ai_ci,IMPLICIT) for operation like'. Fix: add explicit 'COLLATE utf8mb4_unicode_ci' on the LIKE expression to force the comparison to the column's collation. EXPLICIT collation trumps any IMPLICIT operand, so the LIKE works regardless of the database default collation. VERIFICATION End-to-end CALL on a MySQL 8 instance with the default session sql_mode (no IGNORE_SPACE) and database default collation utf8mb4_0900_ai_ci, against a table whose name column is utf8mb4_unicode_ci, completes with @r=0 (success) and produces result rows. Pre-fix, the same CALL failed at the protocol layer with 'expected 7, got 8'. After fixing only #1 and #2, it failed with 'FUNCTION TRIM does not exist'. After also fixing #3, it failed with 'Illegal mix of collations'. After all four, search runs end-to-end. SQL_Server versions are intentionally untouched (they already work correctly via T-SQL syntax). --- MySQL/Procedures/RMCObject/search_RMCObject.sql | 11 ++++++----- MySQL/Procedures/RMTObject/search_RMTObject.sql | 14 +++++++++----- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/MySQL/Procedures/RMCObject/search_RMCObject.sql b/MySQL/Procedures/RMCObject/search_RMCObject.sql index 30c909b..2453bc9 100644 --- a/MySQL/Procedures/RMCObject/search_RMCObject.sql +++ b/MySQL/Procedures/RMCObject/search_RMCObject.sql @@ -30,12 +30,13 @@ CREATE PROCEDURE search_RMCObject IN dX DOUBLE, IN dY DOUBLE, IN dZ DOUBLE, - IN sText VARCHAR (48) + IN sText VARCHAR (48), + OUT nResult BIGINT ) BEGIN DECLARE MVO_RMCOBJECT_TYPE_SATELLITE INT DEFAULT 15; - DECLARE bError INT; + DECLARE bError INT DEFAULT 0; DECLARE bCommit INT DEFAULT 0; DECLARE nError INT DEFAULT 0; @@ -62,7 +63,7 @@ BEGIN IF bError = 0 THEN - SET sText = TRIM (IFNULL (sText, '')); + SET sText = TRIM(IFNULL(sText, '')); IF sText <> '' THEN @@ -85,7 +86,7 @@ BEGIN POW(4.0, o.Type_bType - 7) AS dFactor, -1 AS dDistance FROM RMCObject AS o - WHERE o.Name_wsRMCObjectId LIKE CONCAT(sText, '%') + WHERE o.Name_wsRMCObjectId LIKE CONCAT(sText, '%') COLLATE utf8mb4_unicode_ci AND o.Type_bType BETWEEN bType + 1 AND MVO_RMCOBJECT_TYPE_SATELLITE ORDER BY POW(4.0, o.Type_bType - 7) * (-1) DESC, o.Name_wsRMCObjectId LIMIT 10; @@ -164,7 +165,7 @@ BEGIN DROP TEMPORARY TABLE Error; - SET nError = bCommit - bError - 1; + SET nResult = bCommit - 1 - nError; END$$ DELIMITER ; diff --git a/MySQL/Procedures/RMTObject/search_RMTObject.sql b/MySQL/Procedures/RMTObject/search_RMTObject.sql index c5328a3..697789c 100644 --- a/MySQL/Procedures/RMTObject/search_RMTObject.sql +++ b/MySQL/Procedures/RMTObject/search_RMTObject.sql @@ -30,14 +30,15 @@ CREATE PROCEDURE search_RMTObject IN dX DOUBLE, IN dY DOUBLE, IN dZ DOUBLE, - IN sText VARCHAR (48) + IN sText VARCHAR (48), + OUT nResult BIGINT ) BEGIN DECLARE MVO_RMTOBJECT_TYPE_COMMUNITY INT DEFAULT 9; - DECLARE bError INT; + DECLARE bError INT DEFAULT 0; DECLARE bCommit INT DEFAULT 0; - DECLARE nError INT; + DECLARE nError INT DEFAULT 0; DECLARE bType TINYINT UNSIGNED; DECLARE dRange DOUBLE; @@ -75,7 +76,7 @@ BEGIN IF bError = 0 THEN - SET sText = TRIM (IFNULL (sText, '')); + SET sText = TRIM(IFNULL(sText, '')); IF sText <> '' THEN @@ -98,7 +99,7 @@ BEGIN FROM RMTObject AS o JOIN RMTMatrix AS m ON m.bnMatrix = o.ObjectHead_Self_twObjectIx - WHERE o.Name_wsRMTObjectId LIKE CONCAT(sText, '%') + WHERE o.Name_wsRMTObjectId LIKE CONCAT(sText, '%') COLLATE utf8mb4_unicode_ci AND o.Type_bType BETWEEN bType + 1 AND MVO_RMTOBJECT_TYPE_COMMUNITY ORDER BY POW (4.0, o.Type_bType - 7) * ArcLength (dRadius, dX, dY, dZ, m.d03, m.d13, m.d23), o.Name_wsRMTObjectId LIMIT 10; @@ -179,6 +180,9 @@ BEGIN DROP TEMPORARY TABLE Error; DROP TEMPORARY TABLE Result; + + SET nResult = bCommit - 1 - nError; + END$$ DELIMITER ;