Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Processing loop runs out of memory or handles or somethi
Message
From
07/10/2013 12:36:48
 
 
To
07/10/2013 12:06:35
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:
01584860
Message ID:
01584919
Views:
41
>Hillmar. Gregory, Tore, Thomas
>
>Thank you all so much. Stuff like this make me realize how long I've been away from working with VFP and DBFs and how some stuff that should be obvious just escaped me.
>
>Gregory, great suggestions, especially re the buffers - couldn't remember how to use sys calls on those.
>
>Which field types am I missing ( though this is for use against a particular DB and does cover all cases I thought I had all the VFP data types?)

Charles,
B
F  (never used it)
V
W
Q
G (I hope not)
Also, for the C and M types - check the NOCPTRANS

You may not be using them - but if you don't know for sure - add an OTHERWISE + error


>I'll report back.
>
>>In addition to Hilmar's suggestion to close the table and the cursor (lcalias/lcname ) before ENDIF/ENDFOR && tablescan
>>
>>Either or both of
>>(1) Reduce the foreground and background buffer size - sys(3050, ...). Set them to 256 Mb
>>(2) =sys(1104) before ENDIF/ENDFOR && tablescan (after closing the table and the cursor)
>>
>>ps:
>>No need to test IIF(N < lnflds,',','')+lf
>>Always add , and lf
>>
>>You can drop the last ones just after ENDFOR && field scan
>>
>>pps:
>>
>>Add an OTHERWISE with error condition to the CASE fieldscan. You're not testing all field types
>>
>>>
>>>
>>>USE tablesql IN 0 EXCLUSIVE
>>>SELECT tablesql
>>>DELETE ALL
>>>PACK
>>>PACK memo
>>>
>>>lcexppath = 'c:\users\public\sql\'
>>>
>>>lcpath=ADDBS(THIS.oparentbizobj.getfield("cpath_to_vfp"))+"convert"
>>>SET DEFAULT TO (lcpath)
>>>
>>>lcsql = "SELECT  "
>>>
>>>lcdbc="inmatetrustfund.dbc"
>>>
>>>* ITERATE TABLES
>>>
>>>OPEN DATABASE (lcdbc) EXCLUSIVE
>>>
>>>ntables= ADBOBJECTS(latables,"TABLE")
>>>
>>>FOR i=1 TO ALEN(latables,1)
>>>
>>>	lcdbf=latables(i)
>>>	lcalias=JUSTSTEM(lcdbf)
>>>	
>>>	SELECT tablesql
>>>	APPEND BLANK
>>>	REPLACE tablename WITH lcalias
>>>
>>>	WAIT WINDOW lcalias NOWAIT
>>>	
>>>	IF UPPER(lcalias) <> "SYSSETUP"
>>>		USE (lcdbf) IN 0 EXCLU
>>>
>>>		SELECT (lcalias)
>>>
>>>		=AFIELDS(laflds)
>>>		lnflds = ALEN(laflds,1)
>>>		mcnt = 1
>>>
>>>*   SCAN FIELDS
>>>
>>>		FOR N=1 TO lnflds
>>>
>>>			lcfld=ALLTRIM(laflds(N,1))
>>>			lctype=laflds(N,2)
>>>			lnsize=laflds(N,3)
>>>			llnct=laflds(N,6)
>>>
>>>			WAIT WINDOW lcalias + SPACE(10)+lcfld NOWAIT
>>>
>>>			SELECT (lcalias)
>>>
>>>			DO CASE
>>>
>>>			CASE INLIST(lctype,"D","T")
>>>				
>>>				lcsql = lcsql + " NVL(TTOC("+lcfld+",3),[1800-01-01])" + IIF(N < lnflds,',','')+lf
>>>
>>>			CASE (lctype="C" )
>>>
>>>				 lcsql = lcsql + " "+lcfld+ IIF(N < lnflds,',','')+ lf
>>>
>>>		 	CASE INLIST(lctype,'I','N','Y')
>>>
>>>			       lcsql = lcsql + " "+lcfld+IIF(N < lnflds,',','')+lf
>>>
>>>			 CASE (lctype = "L")
>>>
>>>				lcsql = lcsql + " IIF("+lcfld+"=.t.,1,0) "+IIF(N < lnflds,',','')+lf
>>>
>>>			CASE (lctype = "M")
>>>
>>>				 lcsql = lcsql + " IIF(LEN(ALLTRIM("+lcfld+")) < 220, STRTRAN("+lcfld+",CHR(13)+CHR(10),'@@'),'MCOL+"+ALLTRIM(STR(mcnt))+"') "+ IIF(N < lnflds,',','')+lf
>>>
>>>				  mcnt = mcnt+1
>>>
>>>			ENDCASE
>>>
>>>		ENDFOR  && field scan
>>>
>>>		lcsql = lcsql + " FROM "+ lcalias + " INTO CURSOR C_"+lcalias
>>>
>>>		&lcsql
>>>
>>>		lcname = "C_"+lcalias
>>>
>>>		 SELECT (lcname)
>>>
>>>		lcexpstr = [ COPY TO ']+lcexppath+lcname+[' DELIMITED WITH "" WITH CHARACTER '|' ]
>>>
>>>		 &lcexpstr
>>>
>>>		 SELECT tablesql
>>>		 LOCATE FOR ALLTRIM(tablename) = lcalias
>>>		 REPLACE mSQL WITH lcsql
>>>
>>>		lcsql = "SELECT " +lf
>>>
>>>	ENDIF
>>>
>>>ENDFOR && tablescan
>>>
>>>CLOSE DATABASE && inmatetrustfund
>>>
>>>**********************************************************************************************************************
>>>
>>>SET DEFAULT TO (lcdefa)
>>>
>>>RETURN
>>>
>>>
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform