11 messages in com.mysql.lists.plusplusRe: Strange inefficiency with mysql++...
FromSent OnAttachments
John Hunter28 Jul 2001 18:30 
Andrius Armonas29 Jul 2001 03:33 
Ram Kumar29 Jul 2001 05:21 
John Hunter29 Jul 2001 08:24 
Andrius Armonas29 Jul 2001 10:19 
Andrius Armonas30 Jul 2001 07:06 
Andrius Armonas30 Jul 2001 07:13 
Lorenzo30 Jul 2001 07:18 
Sander Pilon30 Jul 2001 07:39 
John Hunter30 Jul 2001 07:40 
dbu...@mindspring.com30 Jul 2001 08:13 
Subject:Re: Strange inefficiency with mysql++ SELECT
From:Andrius Armonas (bau@andrius.org)
Date:07/30/2001 07:13:46 AM
List:com.mysql.lists.plusplus

Lorenzo> Result res = query.store(); Lorenzo> const int iSize = res.size(); Lorenzo> for (int i = 0;i < iSize;i++) Lorenzo> { Lorenzo> cout << res[i]["mycolumnname"]; Lorenzo> // or do something else... Lorenzo> }

That works too (and is a little more readable), and has an execution speed comparable to the method Andrius suggested. I wonder if there is room for improvement in the Row code, given that it runs so much more slowly. I used the Row approach because it is the one in the example program in the mysql++ manual.

if you are still searching where to improve speed, don't use /* ... */ operator [] (const char *) /* ... */ method. You should use cout << (*ib)[0] << (*ib)[1] << (*ib)[2] /* ... */; instead of cout << (*ib)["mycolumnname0"] << (*ib)["mycolumnname1"] << (*ib)["mycolumnname2"] /* ... */;