Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Russell Hill
  Where is Russell Hill?
 Sydney
 Australia
 Russell Hill
 To: Leonid Lepin
  Where is Leonid Lepin?
 Riga
 Latvia
 Leonid Lepin
 Tags
Subject: RE: Build string with SQL?
Thread ID: 311134 Message ID: 311258 # Views: 39 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: General VFP Topics
Date: Thursday, June 30, 2011 12:56:49 AM         
   


>
> May be your problem lies in another plane. Concatenating a large amount of strings is very slow operation. It may be done sufficiently faster writting information to low level file. Check the next sample
>
>
>
> create cursor tmp (f1 c(10))
> for i = 1 to 1000000
> 	insert into tmp values ("1234567890")
> next
> 
> m.sc = seconds()
> probString = ''
> SCAN
>    probString = probString + f1
> ENDSCAN
> ?seconds() - m.sc
> 
> m.sc = seconds()
> m.hnd = fcreate("tmp.tmp")
> ?m.hnd
> SCAN
>    fwrite(m.hnd, f1)
> ENDSCAN
> fclose(m.hnd)
> probString = filetostr("tmp.tmp")
> erase ("tmp.tmp")
> ?seconds() - m.sc
> 

>
>
> Leonid

Thanks Leonid.

That works well on 1 million records but maybe doesn't reflect my exact situation.

Actually, the SCAN is on SQL SELECT subsets that have between 10 and 11 records on average.

For example:

DO WHILE NOT EOF()   && Large table A with 200000 records.
   .....
   .....
   SELECT someStuff ;
     FROM aRelatedTableOf2MillionRecords ;
     INTO CURSOR subsetCursor
   SCAN
      =makeMyStr()   && On average, _TALLY = 10 or 11.
   ENDSCAN
   .....
   .....
   SKIP 1
ENDDO

I'm not sure the same advantage can be extracted from your code in that case.

Regards,

Russell.

ENTIRE THREAD

Build string with SQL? Posted by Russell Hill @ 6/29/2011 3:31:04 AM
RE: Build string with SQL? Posted by Samir H. @ 6/29/2011 4:41:13 AM
RE: Build string with SQL? Posted by Russell Hill @ 6/29/2011 2:28:45 PM
RE: Build string with SQL? Posted by Stefan Wuebbe @ 6/29/2011 8:13:05 AM
RE: Build string with SQL? Posted by Russell Hill @ 6/29/2011 2:30:12 PM
RE: Build string with SQL? Posted by Borislav Borissov @ 6/29/2011 8:49:11 AM
RE: Build string with SQL? Posted by Russell Hill @ 6/29/2011 2:32:48 PM
RE: Build string with SQL? Posted by Mike Yearwood @ 6/29/2011 4:30:02 PM
RE: Build string with SQL? Posted by Russell Hill @ 6/30/2011 1:01:10 AM
RE: Build string with SQL? Posted by Mike Yearwood @ 6/30/2011 4:46:23 PM
RE: Build string with SQL? Posted by Samir H. @ 6/30/2011 6:29:30 PM
RE: Build string with SQL? Posted by Russell Hill @ 6/30/2011 10:53:32 PM
RE: Build string with SQL? Posted by Samir H. @ 7/1/2011 5:24:32 AM
RE: Build string with SQL? Posted by Russell Hill @ 7/1/2011 11:29:56 AM
RE: Build string with SQL? Posted by Michel Levy @ 7/1/2011 11:00:28 AM
RE: Build string with SQL? Posted by Russell Hill @ 7/1/2011 11:29:11 AM
RE: Build string with SQL? Posted by Russell Hill @ 6/30/2011 10:51:19 PM
RE: Build string with SQL? Posted by Leonid Lepin @ 6/29/2011 4:44:30 PM
RE: Build string with SQL? Posted by Russell Hill @ 6/30/2011 12:56:49 AM
RE: Build string with SQL? Posted by Tom Saddul @ 6/30/2011 3:36:58 AM
RE: Build string with SQL? Posted by Russell Hill @ 6/30/2011 7:20:40 AM
RE: Build string with SQL? Posted by Anders Altberg @ 7/1/2011 12:40:07 AM
RE: Build string with SQL? Posted by Russell Hill @ 7/1/2011 2:43:58 AM
RE: Build string with SQL? Posted by Anders Altberg @ 7/1/2011 1:31:36 PM
RE: Build string with SQL? Posted by Russell Hill @ 7/1/2011 2:23:04 PM
RE: Build string with SQL? Posted by Anders Altberg @ 7/1/2011 3:31:26 PM
RE: Build string with SQL? Posted by Russell Hill @ 7/1/2011 11:29:12 PM
RE: Build string with SQL? Posted by Anders Altberg @ 7/2/2011 12:51:58 AM
RE: Build string with SQL? Posted by Russell Hill @ 7/2/2011 2:44:25 AM
RE: Build string with SQL? Posted by Anders Altberg @ 7/2/2011 2:05:49 PM
RE: Build string with SQL? Posted by Stefan Wuebbe @ 7/3/2011 10:40:49 AM
RE: Build string with SQL? Posted by Anders Altberg @ 7/3/2011 2:19:55 PM