Bug #12024
_MyConnection: restrict to the current connection, and finish the remaining fields
0%
History
#1 Updated by Greg Shah 15 days ago
_MyConnection: restrict to the current connection, and finish the remaining fields¶
Project: Database
Problem¶
In the 4GL, _MyConnection holds exactly one record: the current session's own connection. Code relies on this with FIND FIRST _MyConnection to get its own user number (_MyConn-UserId), and uses that number to select its own records in other VSTs such as _UserTableStat (_UserTableStat-Conn = _MyConn-UserId) or _Connect.
- Conversion: "a query over this table is converted, but it is not yet restricted to the current user's own connection the way the 4GL restricts it; narrowing it requires a conversion change".
- Runtime: "the table is populated, but a user can currently see every other user's connection records rather than only their own; _myconn-numseqbuffers and _myconn-usedseqbuffers are stubs".
The current source suggests the restriction may already be in place, at least on H2. DDLGeneratorWorker (MY_CONNECTION_AUX) creates a view, meta_myconnection, over the table meta_myconnection_, filtered by my_conn_user_id = fwdSession_1(), with an INSTEAD OF trigger handled by persist/h2/UpdatableMyConnectionView. ConnectTableUpdater sets my_conn_user_id to the session id. So it is not known which of the recorded limitations still hold.
Work¶
- Establish the current state with testcases, with two or more sessions connected at the same time:
- what
FIND FIRST _MyConnection,FOR EACH _MyConnectionand a dynamic query over it return in each session; - whether the converted query actually goes through the filtered view or reads the underlying table directly;
- whether this holds for every way the metadata database can be configured, and on every dialect the metadata tables can live in.
- what
- Restrict the table to the current connection wherever that is not already the case, so that every static and dynamic query returns only the session's own record.
- Make sure
_MyConn-UserIdis the same value that identifies the session in_Connect(_Connect-Usr) and_UserTableStat(_UserTableStat-Conn), so the joins 4GL code makes between these tables work. - Check
_MyConn-Pidagainst_Connect-Pidfor the same session. - Implement
_MyConn-NumSeqBuffersand_MyConn-UsedSeqBuffers, or report a fixed value that matches what OpenEdge reports for a session with no sequence activity, whichever the OpenEdge behaviour supports. - Update the gap marking for
_myconnectionand its fields.
Testcases¶
Each with an OpenEdge baseline:- one session: the record count, and every field of the record;
- two concurrent sessions: each sees only its own record, and the user numbers differ;
_MyConn-UserIdused to find the session's own records in_Connectand_UserTableStat;- a session that disconnects and reconnects.