Dustin Moore wrote:
>
> if (result.at(0)["Unit_id"] != mysqlpp::null) {
Sorry, I got caught up in all the 2.3isms in critiquing your code. The
real issue is that data type of the left hand side of that test is
mysqlpp::String, which doesn't know how to compare itself to
mysqlpp::null. Your choices are:
1. if (!result.at(0)["Unit_id"].is_null()) ...
2. if (Null<SomeType>(result.at(0)["Unit_id"]) != mysqlpp::null) ...
3. wait for the next version, which will let you do this comparison
> I used the [] operator instead of the at() function and received:
> error: no match for ‘operator[]’ in ‘result[0]’
It may be a side effect of the fact that the previously suggested code
doesn't compile. If you still can't use this feature after taking one
of the alternatives above, it would seem you have some compiler
limitation. I've tested this here on my CentOS 5.1 system (g++ 4.1.2),
and it *does* work. I've made it part of the examples, so it will get
further tested on other compilers before the next release.