Chris Frey wrote:
> On Tue, Oct 25, 2005 at 03:14:52PM -0400, Alex Vishnev wrote:
>> Query q << "select * from table";
>> mysqlpp::ResUse use = q.use();
>> while ((row = use.fetch_row()))
>> string col1 = (string)row.lookup_by_name("col1");
>> string col2 = (string)row.lookup_by_name("col2")
>> float col3 = row.lookup_by_name("col3");
> Before you jump completely to C, you might try using the .at() function
> to reference fields by index instead of by name. This removes the repeated
> name lookup on each cycle of your loop.
> I haven't done timings, so I don't know if this is significant.
> - Chris
The name lookups aren't what cause the slowdown (for me, at least) -- it's
translating from a mysql row to a MySQL++ Row object that takes all the time.