Description


\"1) Get information of the current transaction status of an instance. 1a) The current transaction number $TRANSNUMBER() When using $ioprint, UnifAce itself tells us, which transaction is currently in access: \"\"I/O function: F, mode: 0, on file/table: a_table, Trans# 1 index: 1 =\"\" 1b) Further information of the transaction $TRANSPROPERTIES(,) Get information of the state of a transaction. Topic \"\"INSTANCE_LST\"\":List assigned instances \"\"PATH_LST\"\" :List of open pathes (or better a list of identifiers of open pathes) \"\"TABLE_LST\"\" :List of open tables/entities (or better a list of identifiers of open tables) ... : What ever information is usefull to have Using of the number 0 give information of all transaction in a summary, plus \"\"TRANS_LST\"\" :List of all transaction numbers in use 1c) Information of a path $PATHPROPERTIES(,) Get information of the state of a path in a transaction When using pathname instead of a pathinstance, uniface will assume this path in current transaction Topic \"\"NAME\"\" : Name of the path as defined in ASN-file or OPEN statement \"\"TRANSNUMBER\"\": Number of the transaction holding this path instance \"\"TABLE_LST\"\" : List of open tables/entities (or better a list of identifiers of open tables) ... : What ever information is usefull to have 1d) Information of a open table/entity $TABLEPROPERTIES(,) When using tabelname instead of a tableinstance, uniface will assume this table in current component and transaction Get information of the state of a open table in a transaction Topic \"\"NAME\"\" : Name of the table \"\"MODELL\"\" : Modell name \"\"PATHINST\"\" : Pathinstance ... : What ever information is usefull to have 2) New switch on NEWINSTANCE to use a given transaction NEWINSTANCE ,,\"\"TRANSNUMBER=\"\" Attach the new instance to a give transaction instead of open a new one.\"

Use Case


\"1a) v_TR=$transnumber(v_INST) , v_TR= the transaction number to which v_INST is assigned 1b) NEWINSTANCE \"\"C1\"\",v_INST1 NEWINSTANCE \"\"C2\"\",v_INST2,\"\"TRANSACTION=T\"\" , C1 will open table/entity TAB11 and TAB12 (on DEF) , C2 will open path $MY_PATH and table/entity TAB21 putmess $transproperties(0,\"\"TRANS_LST\"\") , \"\"1·,2\"\" putmess $transproperties(0,\"\"INSTANCE_LST\"\") , v_INST1·,v_INST2 putmess $transproperties(1,\"\"INSTANCE_LST\"\") , v_INST1 putmess $transproperties(2,\"\"INSTANCE_LST\"\") , v_INST2 putmess $transproperties(1,\"\"PATH_LST\"\") , \"\"_DEF#1\"\" putmess $transproperties(1,\"\"TABLE_LST\"\") , \"\"_DEF#1:TAB11·,_DEF#1:TAB12\"\" putmess $transproperties(2,\"\"PATH_LST\"\") , \"\"_MY_PATH#2\"\" putmess $transproperties(2,\"\"TABLE_LST\"\") , \"\"_MY_PATH#2:TAB21\"\" 1c) (assumption as 1b) putmess $PATHPROPERTIES(\"\"DEF#1\"\",\"\"NAME\"\") , \"\"DEF\"\" putmess $PATHPROPERTIES(\"\"DEF#1\"\",\"\"TRANSENUMBER\"\") , 1 putmess $PATHPROPERTIES(\"\"DEF#1\"\",\"\"TABLE_LST\"\") , \"\"_DEF#1:TAB11·,_DEF#1:TAB12\"\" putmess $PATHPROPERTIES(\"\"MY_PATH#1\"\",\"\"NAME\"\") , \"\"MY_PATH\"\" putmess $PATHPROPERTIES(\"\"MY_PATH#1\"\",\"\"TRANSENUMBER\"\") , 2 putmess $PATHPROPERTIES(\"\"MY_PATH#1\"\",\"\"TABLE_LST\"\") , \"\"_MY_PATH#2:TAB21\"\" 1d) (assumption as 1b) putmess $TABLEPROPERTIES(\"\"DEF#1:TAB11\"\",\"\"NAME\"\") , \"\"TAB11\"\" putmess $TABLEPROPERTIES(\"\"DEF#1:TAB11\"\",\"\"MODELL\"\") , \"\"A_MODELL\"\" putmess $TABLEPROPERTIES(\"\"DEF#1:TAB11\"\",\"\"PATHINST\"\") , \"\"_DEF#1\"\" putmess $TABLEPROPERTIES(\"\"DEF#1:TAB12\"\",\"\"NAME\"\") , \"\"TAB12\"\" putmess $TABLEPROPERTIES(\"\"DEF#1:TAB12\"\",\"\"MODELL\"\") , \"\"A_MODELL\"\" putmess $TABLEPROPERTIES(\"\"DEF#1:TAB12\"\",\"\"PATHINST\"\") , \"\"_DEF#1\"\" putmess $TABLEPROPERTIES(\"\"MY_PATH#2:TAB11\"\",\"\"NAME\"\") , \"\"TAB21\"\" putmess $TABLEPROPERTIES(\"\"MY_PATH#2:TAB11\"\",\"\"MODELL\"\") , \"\"A_MODELL\"\" putmess $TABLEPROPERTIES(\"\"MY_PATH#2:TAB11\"\",\"\"PATHINST\"\") , \"\"_MY_PATH#2\"\" 2) NEWINSTANCE \"\"C1\"\",v_INST1 v_TR1=$transnumber(v_INST1) , v_TR1=1 (default transaction) NEWINSTANCE \"\"C2\"\",v_INST2,\"\"TRANSACTION=T\"\" v_TR2=$transnumber(v_INST2) , v_TR1=2 NEWINSTANCE \"\"C3\"\",v_INST3,\"\"TRANSNUMBER=%%v_TR1\"\" v_TR3=$transnumber(v_INST3) , v_TR3=1 NEWINSTANCE \"\"C4\"\",v_INST4,\"\"TRANSNUMBER=%%v_TR2\"\" v_TR4=$transnumber(v_INST4) , v_TR4=2\"

Importance


First: It\'s allways good to knew, what\'s going on in an application. Think about debugging or error reporting Second: You have to minimze open connections to the database. This can have to reasons a) licence politics of database vendor b) (dead) locking issues. Every time NEWINSTANCE with TRANSACTION=T will open a new connetion to the database. From database side this conections all all independend and will block each other when lock a row. If it is nescassary to have more then one transaction it is not easy to determine if one have to open a new transaction or reuse teh curren t E.g: component C1 runs on trans #2 and use a common table component C2 runs on trans #3 as it have to commit/rollback independ of C1 C2 will start a component C3 to get and set further information. This transaction C3 have to be run in the environment of transaction #2 as it also use this common table C3 is independed of C1 and both components could be started and stopped every time How to archiev this?

Type


Scripting/Coding

Operating System


Not Applicable

Status


Open

Leave a Reply