Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with Cursor Adapter and interrupting the process
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Problem with Cursor Adapter and interrupting the process
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01080258
Message ID:
01080258
Vues:
57
UPDATE. The problem is resolved now. In the error and CursorFill of _caBase class I changed the code to
if vartype(m.plStop) = "L"
		this.lRepeatRequery = not m.plStop
	endif
and it works.

Hi everybody,

We were using CA builder class for VFP8 by Mark McCasland and I was able to interrupt the long select statements with a Question:

Do you want to stop the process? Yes/No.

If I answered yes, I stopped the process, otherwise I re-started it from the beginning. It worked fine and I tested it. We switched to CA Builder for VFP9. I put the same code in the Error routine for this class. However, now it doesn't work the same way, e.g. if I answer No it either stops or produces an error. Here is the code in CursorFill method of the class
lparameters lUseCursorSchema, lNoData, nOptions, uSource
if not pemstatus(this, 'lADO_Done', 5)
	this.addproperty('lADO_Done')
endif
if this.datasourcetype = [ADO] and not this.lADO_Done
	return
endif
local llSchema, llNoData, lnOptions, luSource
llSchema  = lUseCursorSchema
llNoData  = lNoData
lnOptions = nOptions
luSource  = uSource
if vartype(this.nFillOptions) <> "N"
	this.nFillOptions = -1
endif
if pcount() < 1 or vartype(llSchema) <> "L"
	llSchema = this.usecursorschema
endif
if pcount() < 2 or vartype(llNoData) <> "L"
	llNoData = this.nodata
endif
if pcount() < 3 or vartype(lnOptions) <> "N"
	lnOptions = iif(this.datasourcetype = [ADO], this.nFillOptions, 0)
endif
local llRetVal
if this.datasourcetype = [ADO]
	llRetVal = dodefault(llSchema, llNoData, lnOptions, this.oADO_Command)
else
	if pcount() = 4
		llRetVal = dodefault(llSchema, llNoData, lnOptions, luSource)
	else
		llRetVal = dodefault(llSchema, llNoData, lnOptions)
	endif
endif
nodefault
if not m.llRetVal && There was an error trying to execute CursorFill
	local laError[1]
	aerror(laError)
	if laError[1,1] <> 1839
		=ErrorMsg("Error trying to execute CursorFill method: " + laError[1,2] + ;
			chr(13) + chr(10) + "SelectCMD is " + this.selectcmd)
	endif
endif

return m.llRetVal
This is the code from Error method:
LPARAMETERS tnError, tcMethod, tnLine
SET STEP ON 
IF m.tnError = 1839 && SQL-Select was cancelled	
   
	IF VARTYPE(m.plStop) = "L" AND m.plStop 
		* Have we stopped already?
		IF TYPE("this.parent.parent")= "O" AND ;
			PEMSTATUS(this.Parent.Parent,'lRepeatRequery',5) 
			this.parent.parent.lRepeatRequery = .f.
		endif	
	ELSE
		* RETRY  - doesn't work
		IF TYPE("this.parent.parent")= "O" AND ;
			PEMSTATUS(this.Parent.Parent,'lRepeatRequery',5) 
			this.parent.parent.lRepeatRequery = .t.
		endif	
	ENDIF
ELSE
	DODEFAULT(m.tnError, m.tcMethod, m.tnLine)
ENDIF
And this is the execution code:
local lnRequeryResult
	lnRequeryResult = .requery(.t., "ca_Search")

	do while m.loCursorAdapter.lRepeatRequery = .t. and m.lnRequeryResult <> REQUERY_SUCCESS && the user tried to stop it
		lnRequeryResult = .requery(.t., "ca_Search")
		loCursorAdapter.lRepeatRequery = .f.
	enddo
Do you see, why it stopped working?

Thanks in advance.

If it's not broken, fix it until it is.


My Blog
Répondre
Fil
Voir

Click here to load this message in the networking platform