Re: LOCKS question
Posted in 1997
Fernando.Collalti@orbit.net ("Collalti, Fernando") wrote: : :Hello, : :a) Is there a way, from an application, to know who holds a lock without :looking : to the sysslocks table and the related Session Id (from syssessions :table) ? No, I don't think so. :b) Is there a way, always from an application, to know if TP is off or on? Yes. Here is some old 4GL code that give you information about the database and transaction support. We use it to be able to run the same applications on databases with and without logging. It's all based on data available in the sqlca structure immediately after a database statement. We obviously do not include all this in any module in our programs as it might break any day (if Informix desides to change something). Instead we use it only to generate data that's stored in a single row table we have and we read from that when a program is started to get at this information. database "dbname" let p_online = false let gdb_trans = false let gdb_beginwork = false whenever error stop if sqlca.sqlawarn'1' = "W" then # Some warning has been set: if sqlca.sqlawarn'4' = "W" then let p_online = true end if if sqlca.sqlawarn'2' = "W" then # Database uses transactions let gdb_trans = true end if if sqlca.sqlawarn'3' = "W" then # ANSI standard database (not a good idea!). let gdb_beginwork = false error "WARNING: ANSI database. Expect significant problems." message "WARNING: ANSI database. Expect significant problems." prompt "Press Enter to continue " for g_answ on key(F10) let int_flag = true end prompt if not int_flag and g_answ = "@" then else exit program end if if gdb_trans then else error "SERIOUS ERROR: ANSI database with no transactions." message "SERIOUS ERROR: ANSI database with no transactions." prompt "Press Enter to continue " for g_answ on key(F10) let int_flag = true end prompt if not int_flag and g_answ = "@" then else exit program end if end if else # NOT ANSI standard database (the standard way we run!). if gdb_trans then # begin work need when transactions are used: let gdb_beginwork = true end if end if # else # No warning set so we have no transactions. end if Nils.Myklebust@idg.no NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway My opinions are those of my company The Informix FAQ is at http://www.iiug.org