From: Warren Young Date: November 13 2006 11:26pm Subject: Re: Exception of type std::length_error List-Archive: http://lists.mysql.com/plusplus/6104 Message-Id: <4558FF43.2030203@etr-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Mathieu Pagé wrote: > > > mysqlpp::Row row; > mysqlpp::Row::size_type i; > for (i = 0; row = res.at(i); ++i) > cout < > > however I get an length_error exception on "row = res.at(i)". I think you're expecting Row::at() to return false (or, rather, an object that can be converted to false) when you walk off the end of the result set. MySQL++ doesn't do that sort of thing, by design. It signals errors with exceptions, just as you saw. That is the fall-back behavior when you turn off exceptions, however. Read the user manual for details. You might also look at examples/simple3.cpp. It operates in a way very similar to what you're doing, without needing special treatment. It does that by using a different type of query than you are using.