Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Pulling Data from a Huge Cursor
Message
From
03/03/2014 06:46:48
 
 
To
03/03/2014 06:19:19
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01595090
Message ID:
01595654
Views:
40
Thanks for Guidance Sir,
I was not aware that If set exact is ON there is no need to ALLTRIM(). Infact in my entire code and even in all my previous petty programs I have done so.

Sir, What is the reason of using varchar ?

I will Try to make changes in my code tonight based on the resource you have provided and will let you know tomorrow.

Thanks sir.







>Hi Harsh,
>
>Happy how you brilliantly survived some pointless attacks you faced recently here - great lesson for many of us in western countries!
>
>From my experience, VFP performance is very sensitive to the number of instructions executed and, of course, for/where optimization.
>
>Please find hereafter some optimization hints,
>
>
>set exact on
>local lPosSeen as Boolean
>Scan  && Scans for New_bills up to EOF()
>*	cPsfilepath=Alltrim(Fullpath) && used only once, can be moved to the related instruction, aliased with 'New_bills'
>*	Newpath=Alltrim(Newpath) && looks like you use this nowhere
>
>	Create Cursor Cursor_AllBills (POS varchar(254),PAGENUM I,posR N(8,3),posC N(8,3)) && Create Temporary Cursor For Cursor_AllBills
>*	Select Cursor_AllBills && useless - Create Cursor automatically selects the alias
>	
>	* Setting a flag saying whether POS has been encountered should be faster than checking recno() - just a thought
>	lPosSeen = .F.
>	Append From (Alltrim(New_bills.Fullpath)) sdf for lPosSeen(@m.lPosSeen) && moved from above
>
>	* we can apply the same logic to the records before 'POS'
>	create CURSOR Cursor_Header (POS varchar(254))
>	lPosSeen = .F.
>	Append From (Alltrim(New_bills.Fullpath)) sdf for !lPosSeen(@m.lPosSeen)
>
>	&& the above code replaces these lines
>*	Locate For POS = '%%EndSetup:' && you can avoid Alltrim() with SET EXACT ON
>*	HeaderRecordNumber=Recno() && Finds the Header Record Number for Each PS File
>*	SELECT POS FROM Cursor_AllBills INTO CURSOR Cursor_Header Where Recno()<= HeaderRecordNumber 
>*	Delete From Cursor_AllBills Where Recno()<= HeaderRecordNumber
>
>	Do Split
>endscan
>
>function lPosSeen(lPosSeen)
>lPosSeen = m.lPosSeen or POS = '%%EndSetup:' && Alltrim() is useless with SET EXACT ON
>return m.lPosSeen && update to first post
>
Harsh
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform