5 messages in com.mysql.lists.win32Re: AW: slow for loop processing[Scan...
FromSent OnAttachments
Stefan Büchele15 Mar 2004 23:33 
Michael Lyszczek16 Mar 2004 05:44 
Stefan Büchele16 Mar 2004 06:14 
Michael Lyszczek16 Mar 2004 06:24 
Armin Schöffmann16 Mar 2004 07:39 
Subject:Re: AW: slow for loop processing[Scanned]
From:Michael Lyszczek (mi@flytrading.com)
Date:03/16/2004 05:44:32 AM
List:com.mysql.lists.win32

Ahh, so I would just declare a pointer and set those equal to res.begin and res.end... Thanks so much., Michael

Stefan Büchele wrote:

Hi,

for every execution of your loop the function "res.end()" is called. Put the result of this function into a variable check against this variable in the loop.

Best regards Stefan

-----Ursprüngliche Nachricht----- Von: Michael Lyszczek [mailto:mi@flytrading.com] Gesendet: Montag, 15. März 2004 14:52 An: win@lists.mysql.com Betreff: slow for loop processing[Scanned]

Hi, I am running mysql on a 2.8 ghz xeon box using RH9....I am connecting to it via mysql++ in a windows environment. I can pull data off the database server no problem, but when I try to process it, I might as well wait an hour. All I am trying to do is take the Result, iteratre thru it, and push the values into lists. This shouldn't take that long. My code is as follows.... All of the sprintf and printing is just for diagnostic stuff. It is quite simple what I am trying to do , but it is not efficieint at all. Anyone have any ideas? void CTradingdemoDlg::ForLoop() { int x=0; Result::iterator i; Row row;

for(i=res.begin(); i<res.end(); i++) { row = *i; char buffer[200];

CString cDisplayString; time.push_front(row[0]); date.push_front(row[1]); open.push_front(row[2]); high.push_front(row[3]); low.push_front(row[4]); close.push_front(row[5]);

sprintf(buffer, "O %s", row[3]); x=x+1; if (x%20000==0) { pList2->AddString("20k"); }

if(x==150000) { row = *i; pList2->AddString(row[1]);

}

}

}