determining transaction through 4gl
Posted in 1999
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Transactions, Locking & Isolation
Austin, Depending on the version of the online engine being used you could examine the SMI tables ie sysdatabases. This table holds columns for unbuffered,buffered logging status for all databases within the instance. Austin Castro <acastro@btl.net> wrote in article <775ees$d4q$1@news.xmission.com>... > > Hi Guyz, > Does anyone know if there's a way through 4gl to determine if a database > has transaction loggin turned on. > > austin castro >
Austin Castro wrote: > > Hi Guyz, > Does anyone know if there's a way through 4gl to determine if a database > has transaction loggin turned on. Immediately after the DATABASE or CONNECT statement that opens the database check the values of sqlca.sqlwarn.sqlwarn1 and sqlca.sqlwarn.sqlwarn2. If warn1='W' then the database has logging and it is OK to commit or rollback. If warn2='W' then the database is an ANSI mode database and BEGIN WORK is NOT permitted so the logic goes: IF (sqlca.sqlwarn.sqlwarn1 == "W") THEN LET CommitsOK = 1 ELSE LET CommitsOK = 0 END IF IF (sqlca.sqlwarn.sqlwarn2 != "W") THEN LET BeginsOK = 1 ELSE LET BeginsOK = 0 END IF and whenever you start a transaction: IF (BeginsOK) THEN BEGIN WORK END IF and whenever it is time to commit or rollback a transaction: IF (CommitsOK) THEN IF (Errors) THEN ROLLBACK WORK ELSE COMMIT WORK END IF ELSE IF (Errors) THEN ' Scream real loud and try to unwind everything END IF END IF Art S. Kagel
Hi Guyz, Does anyone know if there's a way through 4gl to determine if a database has transaction loggin turned on. austin castro
In article <775ees$d4q$1@news.xmission.com>, Austin Castro <acastro@btl.net> wrote: > > Hi Guyz, > Does anyone know if there's a way through 4gl to determine if a database > has transaction loggin turned on. > > austin castro > We have a standard piece of code at the start of each of our 4GL programs as follows :- IF sqlca.sqlawarn[4] = "W" and sqlca.sqlawarn[2] = "W" and sqlca.sqlawarn[3] <> "W" then LET P_logging = true ELSE LET P_logging = false END IF ... where P_logging is defined as a smallint variable. Interrogation of P_logging thereafter yields the required result. The above code is based upon (aging) Informix-4GL v4.10 but I believe will work with versions beyond this. Kind regards Glyn Balmer DBA BICC Cables Limited Erith Kent UK "Nothing succeeds like a toothless budgerigar" -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own