Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
5
Erster Beitrag:
vor 7 Jahren, 7 Monaten
Letzter Beitrag:
vor 7 Jahren, 7 Monaten
Beteiligte Autoren:
Steven Sitas, BLS

Transactions - Clarion vs WinDEV15

Startbeitrag von Steven Sitas am 04.10.2010 09:33

Hi,

In Clarion we can do the following:
LOGOUT
! Do any kind of file processing
! Check for business rules, data validation etc
and do wherever we want in code - a COMMIT or a ROLLBACK.

After a ROLLBACK (triggered by a data validation), we can start the above code - as many times as we wish. All this from the SAME BUTTON.

Using HF C/S and WinDEV 15 - I can't make this scenario work in WinDEV15.
Doing the same type of code with WinDEV, ALL the failed (cancelled) database operations are "posted" to the database as soon as a succesful HTransactionEnd is issued.

It seems like the HTransactionCancel DOESN'T clear everything from the PREVIOUS failed transactions.
Ofcourse everything works OK in WinDEV, IF I CLOSE the window that has the above code- and then RUN the code again ....

any Ideas?

Steven Sitas



Antworten:

Interesting question.
In case that I understand your problem correctly I would try this pattern.

// GLOBAL WINDOW Declarations

CONSTANT
CANCELTRANSACTION = -1000
END

WHEN EXCEPTION
SWITCH ExceptionInfo(errCode)
CASE CANCELTRANSACTION
HTransactionCancel()
OTHER CASE

END
END


And your update code .. PROCEDURE UpdateOder()

// Start transaction
HTransactionStart()
ScreenToFile() // for instance
WHEN EXCEPTION IN
HAdd(Order) // No need to throw an exception, this is done by WD
HAdd(Orderline) // ditto
IF QuantityInStock(ID) < 0 THEN ExceptionThrow(CANCELTRANSACTION)

HTransactionEnd() // Validate the addition
DO
HTransactionCancel() // Delete order and (in case) order lines
END


Completely untested..not a smart sample.....have not done WD development for at least 6 month.. HTH
Bjoern

von BLS - am 15.10.2010 15:42
thanks Bjoern,

I have already found the problem with HF C/S transactions.
See my other posts if you are interested.

Steven Sitas

von Steven Sitas - am 15.10.2010 15:56
Hi Steven. where is your solution ?


von BLS - am 15.10.2010 16:01
Hi,
search in this forum , look for "Steven Sitas".
In a few words - it is TOTALY VALID to do any kind of logical validation and exit from a HF C/S Transaction.
The only thing to look for, is that the window that starts the transaction MUST have HF C/S context TURNED ON.

Steven Sitas

von Steven Sitas - am 15.10.2010 16:06
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.