3 messages in com.mysql.lists.plusplusProblem with the results interator
FromSent OnAttachments
Mark Rader17 Jan 2002 18:05 
Francois Toubol (Business E-Mail)18 Jan 2002 04:02 
Paul Aitman18 Jan 2002 04:33 
Subject:Problem with the results interator
From:Mark Rader (mra@utk.edu)
Date:01/17/2002 06:05:37 PM
List:com.mysql.lists.plusplus

Hello Folks,

Attached below is a section of code that works using the interator from the Result class from mysql. It works but it is very very very slow. Is there a faster way to do this. We have tried going to a while loop with no success.

Any help would be appreciated. It gets the data back very quickly 'dbLoad.getDNAdir()', but the iteration grinds the program to a halt.

A second problem is getting a stream out of the information returned if anyone has any ideas.

Result *dbDNA = new Result; dbLoad.getDNAdir(CodisDB,*dbDNA); Result::iterator inter; //cout << "Returned Data" << endl; Row row; if(dbDNA->size() >= 2){

for (inter = dbDNA->begin() ; inter != dbDNA->end(); inter++) { //cout << "Getting new row" << endl; row = *inter; { istrstream dnastream(row[0].c_str()); dnastream >> t; } //cout << "Parsed\n";

if (mrparseerror) { cout << "Bad parse on " << i << "th profile -- skipping\n"; mrparseerror = 0; } else { // cout << "Profile being stored: " << t << endl; { if (mrparseerror) { cout << "Bad parse on " << i << "th profile -- skipping\n"; mrparseerror = 0; } else { // cout << "Profile being stored: " << t << endl; { StoreRequest streq(t); streq.setClientID(1); Tree[0]->Store(streq); //Tree[0]->StoreProfile(t,MAXTREEDEPTH); ++i; } if (i%10000 == 0) cout << "loaded " << i << endl; } } delete dbDNA; }