Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Transaction behavior
Message
 
 
À
07/12/2005 11:11:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01075467
Message ID:
01075796
Vues:
26
Here is the piece of code from my colleague's code:
IF !plFailed AND lnDupeCount <> lnTotal && Batch Transaction
	LOCAL llUpdate
	BEGIN TRANSACTION
	llUpdate = TABLEUPDATE(.T., .T., "load_patients")
	IF !llUpdate
		pcAlias = "load_patients"
	ENDIF
	IF llUpdate
		llUpdate = TABLEUPDATE(.T., .T., "load_names")
		IF !llUpdate
			pcAlias = "load_names"
		ENDIF
	ENDIF
	IF llUpdate
		llUpdate = TABLEUPDATE(.T., .T., "load_address")
		IF !llUpdate
			pcAlias = "load_address"
		ENDIF
	ENDIF
	IF llUpdate
		llUpdate = TABLEUPDATE(.T., .T., "load_phones")
		IF !llUpdate
			pcAlias = "load_phones"
		ENDIF
	ENDIF
	IF llUpdate
		llUpdate = TABLEUPDATE(.T., .T., "load_employers")
		IF !llUpdate
			pcAlias = "load_employers"
		ENDIF
	ENDIF
	IF llUpdate
		llUpdate = TABLEUPDATE(.T., .T., "load_trans")
		IF !llUpdate
			pcAlias = "load_trans"
		ENDIF
	ENDIF
	IF llUpdate
		llUpdate = TABLEUPDATE(.T., .T., "load_relateds")
		IF !llUpdate
			pcAlias = "load_relateds"
		ENDIF
	ENDIF
	IF llUpdate
		llUpdate = TABLEUPDATE(.T., .T., "load_trans_relateds")
		IF !llUpdate
			pcAlias = "load_trans_relateds"
		ENDIF
	ENDIF
	IF llUpdate
		llUpdate = TABLEUPDATE(.T., .T., "load_doctors")
		IF !llUpdate
			pcAlias = "load_doctors"
		ENDIF
	ENDIF
	IF llUpdate
		llUpdate = TABLEUPDATE(.T., .T., "load_trans_doctors")
		IF !llUpdate
			pcAlias = "load_trans_doctors"
		ENDIF
	ENDIF
	IF llUpdate
		llUpdate = TABLEUPDATE(.T., .T., "load_insurances")
		IF !llUpdate
			pcAlias = "load_insurances"
		ENDIF
	ENDIF
	IF llUpdate
		llUpdate = TABLEUPDATE(.T., .T., "load_trans_insurances")
		IF !llUpdate
			pcAlias = "load_trans_insurances"
		ENDIF
	ENDIF
	IF llUpdate
		llUpdate = TABLEUPDATE(.T., .T., "load_payments")
		IF !llUpdate
			pcAlias = "load_payments"
		ENDIF
	ENDIF
	IF llUpdate
		llUpdate = TABLEUPDATE(.T., .T., "load_trans_charges")
		IF !llUpdate
			pcAlias = "load_trans_charges"
		ENDIF
	ENDIF
	IF llUpdate
		llUpdate = TABLEUPDATE(.T., .T., "load_trans_procedure_codes")
		IF !llUpdate
			pcAlias = "load_trans_procedure_codes"
		ENDIF
	ENDIF
	IF llUpdate
		llUpdate = TABLEUPDATE(.T., .T., "load_trans_diagnosis_codes")
		IF !llUpdate
			pcAlias = "load_trans_diagnosis_codes"
		ENDIF
	ENDIF
	IF llUpdate
		llUpdate = TABLEUPDATE(.T., .T., "load_trans_events")
		IF !llUpdate
			pcAlias = "load_trans_events"
		ENDIF
	ENDIF
	IF llUpdate
		END TRANSACTION
	ELSE
		ROLLBACK
		LOCAL ARRAY laError[1]
		LOCAL lcError
		=AERROR(laError)
		lcError = [ Error: ] + ALLTRIM(STR(laError[1])) + "," + ;
			[ Message: ] + ALLTRIM(laError[2])
		=Log_error(lcError, pcAlias)
	ENDIF
ELSE
	LOCAL lcError
	IF VARTYPE(poException) = "O"
		lcError = [  Error: ] + ALLTRIM(STR(poException.ERRORNO)) + "," + ;
			[ Line No: ] + ALLTRIM(STR(poException.LINENO)) + "," + ;
			[ Message: ] + ALLTRIM(poException.MESSAGE) + "," + ;
			[ Procedure: ] + ALLTRIM(poException.PROCEDURE)
		=Log_error(lcError, pcAlias)
	ENDIF
ENDIF
>Hi,
>
>>Thanks a lot, Viv. Here is my colleague's logic: we process the stage tables and make changes in a bunch of our main operational related tables. Then we're saving all the changes made. We need to do that in the transaction because we can not have some tables saved changes and some don't. Since you confirmed the problem it means that we need to make sure to do imports when we don't have users in the system.
>
>Surely it should be possible to keep the execution time of the code within the TRANSACTION.... END TRANSACTION to a reasonable limit. In your original post you showed the following code:
>
>begin transaction
>  llUpdate = tableupdate(.t.,.t.,"First Table")
>  if not llUpdate
>     rollback
>     tablerevert all the changes done previously
>     close the process && That logic is done in a separate method
>  endif
>  ...
>end transaction
>
>What happens in the 'close the process' method and the .... section that takes so long?
>
>Regards,
>Viv
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform