Re: ESQL/C transaction
Posted in 1993
In-Reply-To: <1rgqc7INN72m@emory.mathcs.emory.edu> unifi!goofy.unifi.com!bharat@uunet.UU.NET (Bharat Shah) > I have multiple libraries of ESQL-C functions. A lot of them call one > another. Some functions also have begin/rollback/commit transactions. > Problem I face is before starting transaction, how can I detect that > a transaction has already been started ?? > Multiple "begin work"s obviously (and correctly) is unsuccessful and > returns error. stuff deleted > Any help/suggestions/tips/flame/support welcome ! help: Put your transaction management statements in functions called beginWork(), rollbackWork(), and commitWork(), and use a static variable, trStatus, to store the current state (In transaction/Not in transaction). suggestion: Put your SQL statements in one big prepared statement or procedure so that you only have to check sqlca.sqlcode once. Another benefit of this is that subsequent SQL statements are not executed if an error occurs. tip: The Informix 4GL By Example book which comes with v4.1 has an example of this. flame: You should not mix transaction control statements with DML statements. I consider this to be poor design. -- David W. Chan Tel/Fax: +44 71 488 0679 Objective Research Ltd. Email: dwc@cix.compulink.co.uk