List:MySQL++« Previous MessageNext Message »
From:Zhimin Song Date:August 26 2010 10:46am
Subject:Re: an error when using group by
View as plain text  
hi, Warren:
I found out what is wrong.

I made a selectCount() like following:
......
int result;
StroreQuery res = q.store();
result = res[0][0];
return result;
......

my error happened thit place, esp. when the res is empty, that is res.size()
= 0, then it will corrupt.

so the right one is :
......
int result;
StroreQuery res = q.store();
if(res.size() > 0)
     result = res[0][0];
else
     result = 0;
return result;
......

Thanks
Best Regards
Zhimin


2010/7/7 Warren Young <mysqlpp@stripped>

> On 7/3/2010 9:18 PM, Zhimin Song wrote:
>
>>
>> i countered a question like (http://lists.mysql.com/plusplus/7843), but
>> that
>> thread did not say something...
>>
>
> The only thing I see that's similar between these two questions is that
> they're both vague and irreproducible.
>
> I suggest you simplify your code to the point that it either a) works or b)
> is short enough that you can send it to someone else to show them the
> problem on their machine with their database.
>
> The very first thing to do is get all these other libraries (Boost, Wt,
> PList...) out of the way.  It's impossible to point fingers when there are
> so many unrelated actors in the same call stack.
>
> --
> MySQL++ Mailing List
> For list archives: http://lists.mysql.com/plusplus
> To unsubscribe:
> http://lists.mysql.com/plusplus?unsub=1
>
>


-- 
我在若邻:http://cszhmsong.wealink.com;
我的博客:http://hi.baidu.com/zhmsong;

Thread
an error when using group byZhimin Song4 Jul
  • Re: an error when using group byWarren Young6 Jul
    • Re: an error when using group byZhimin Song26 Aug
      • Re: an error when using group byWarren Young26 Aug