Hi All,
I am implementing a script to test if a table is in use, before to call a sequence of operations, that process one table.
In SQL, it is known that I can have complete control over a database/table in a period of time, with BEGIN TRANSACTION ... END TRANSACTION.
In xbasic, I do the following:
1- Test if the table is in use
2- If table is not in use, then :
2.1 - process operation 1
2.2 - process operation 2
...
2.n - process operation n
But, has a operation (post, append, ...) exclusive access to a table?
I test if the table is in use at step 1, but any user can open the table at step 2.2
How to do this is a safe mode?
I am implementing a script to test if a table is in use, before to call a sequence of operations, that process one table.
In SQL, it is known that I can have complete control over a database/table in a period of time, with BEGIN TRANSACTION ... END TRANSACTION.
In xbasic, I do the following:
1- Test if the table is in use
2- If table is not in use, then :
2.1 - process operation 1
2.2 - process operation 2
...
2.n - process operation n
But, has a operation (post, append, ...) exclusive access to a table?
I test if the table is in use at step 1, but any user can open the table at step 2.2
How to do this is a safe mode?
Code:
' Check if a table is open dim shared table_is_Open as L table_is_open = table.in_use("Recpt_Alloc") if (table_is_open) then ui_msg_box("Error","Table is in use.") else ui_msg_box("Ok","Can Continue.") end if END IF 'Conditional code follows. Executes only if the condition expression is True. IF a5_eval_expression("=Var->V_Update_Rec = \"Yes\" .AND. Var->mesgbox001_OK_Button = .T. .AND. Var->table_is_Open = .F.",local_variables()) THEN 'Append from Receipts To Recpt_Alloc query.filter = "App_recpt_aloc <> \"Y\" .AND. Created_Changed_By = User_Name()" query.order = "recno()" DIM operation_name as c operation_name = "AppReceipts_Recept_Aloc" If operation_name <> "" then append.run_silent(operation_name,query.filter) End if ...
Comment