JegasAPI - Jegas, LLC - Copyright(c)2016

Unit uj_locking

DescriptionUsesClasses, Interfaces, Objects and RecordsFunctions and ProceduresTypesConstantsVariables

Description

JAS Specific Functions

Overview

Functions and Procedures

Function bJAS_LockRecord( p_Context: TCONTEXT; p_JLock_JDConnection_ID: ansistring; p_JLock_TableName: ansistring; p_JLock_Row_ID: ansistring; p_JLock_Col_ID: ansistring; p_u8Caller: Uint64 ): Boolean;
function bJAS_RecordLockValid( p_Context: TCONTEXT; p_JLock_JDConnection_ID: ansistring; p_JLock_TableName: ansistring; p_JLock_Row_ID: ansistring; p_JLock_Col_ID: ansistring; p_u8Caller: Uint64 ): Boolean;
function bJAS_UnlockRecord( p_Context: TCONTEXT; p_JLock_JDConnection_ID: ansistring; p_JLock_TableName: ansistring; p_JLock_Row_ID: ansistring; p_JLock_Col_ID: ansistring; p_u8Caller: Uint64 ):boolean;
function bJAS_PurgeLocks(p_Context: TCONTEXT; p_iMinutesOld: integer):boolean;
procedure JAS_DeleteRecordLocks(p_Context: TCONTEXT);
function bJAS_DeleteRecord( p_Context: TCONTEXT; p_TGT: JADO_CONNECTION; p_saTable: ansistring; p_saUID: ansistring ): boolean;

Description

Functions and Procedures

Function bJAS_LockRecord( p_Context: TCONTEXT; p_JLock_JDConnection_ID: ansistring; p_JLock_TableName: ansistring; p_JLock_Row_ID: ansistring; p_JLock_Col_ID: ansistring; p_u8Caller: Uint64 ): Boolean;

Lock Works like this: PART 1-A: Blast ANY OLD LOCKS PART 1-B: Locks without corresponding Session ID's

PART 2: First TRY to LOCK entire Table - if can't - someone else has it. (Loop to try a couple times) (TABLE LOCK= TABLE ID, ROWID=0)

PART 3: Once Table Lock Established, IF ROWID=0 - see if other locks row level exist, if they do - lose the table lock... keeping table locked not permitted, others own rows.

PART 4: If a ROW ID is Specified, lock the ROW and then Lose the Table Lock.

PART 5: If a COL ID is Specified, lock the COL and then Lose the Table Lock.

PART 6: If a ROW and COL ID Are Specified, lock the COL and then Lose the Table Lock.

PART 7: return true or false to indicate lock granted

function bJAS_RecordLockValid( p_Context: TCONTEXT; p_JLock_JDConnection_ID: ansistring; p_JLock_TableName: ansistring; p_JLock_Row_ID: ansistring; p_JLock_Col_ID: ansistring; p_u8Caller: Uint64 ): Boolean;

This function just validates that the LOCK indeed belongs to this session.

function bJAS_UnlockRecord( p_Context: TCONTEXT; p_JLock_JDConnection_ID: ansistring; p_JLock_TableName: ansistring; p_JLock_Row_ID: ansistring; p_JLock_Col_ID: ansistring; p_u8Caller: Uint64 ):boolean;

Do to the Nature of this function, the result is not as important as the lockrecord one. Note: that there are no protections in place from folks deleting records belonging to others and or other data connections so the responsibility of data integrity remains with the programmer.

function bJAS_PurgeLocks(p_Context: TCONTEXT; p_iMinutesOld: integer):boolean;

like its name says - it purges locks older than p_iMinutesOld from jlock table

procedure JAS_DeleteRecordLocks(p_Context: TCONTEXT);

This procedure is called primarily from the error page when a user encounters problems performing an action and chooses to try deleting their own record locks as a way of remedying a problem themselves before contacting their administrator. An error will result if the session is not valid. To Be clear: This function deletes all locks associated with the current session.

function bJAS_DeleteRecord( p_Context: TCONTEXT; p_TGT: JADO_CONNECTION; p_saTable: ansistring; p_saUID: ansistring ): boolean;
 
http://www.jegas.com
Generated by PasDoc 0.14.0.