logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: exception when the field's value is NULL: msg#00070

Subject: Re: exception when the field's value is NULL
Tommy Tang wrote:
I have investigated the reason why it still failed in my computer, I used gdb 
to debug the real reason and got the following information:

1. I set a breakpoint on the line :
 unsigned int nMaxID = row["MaxID"],

2. step into it and get to MysqlRow::operator[](char const*) const (i="MaxID") 
at row2.hh:19
return (*this)[res->field_num(std::string(i)];
3.step to MysqlResUse:;field_num(std::string const &) const  at result2.hh:12
   if ( !_names ) _names = new FieldNames(this);
4. next to get to the line 13:
   return (*_names)[i];

5. next to get to MysqlRow::operator[](char const*) const (i="MaxID") at 
row2.hh:20

6. step into to get to Mysql_ColData<const_string>::operator unsigned() const 
at coldata1.hh:80
    operator unsigned int() const { return conv((unsigned int)0); }

7.step into to get to unsigned 
mysql_ColData<const_string>::conv<unsigned>(unsigned) const(dummy=0) at 
coldata4.hh:12
   std::string strbuf = buf;

8. next till to the line 18 of coldata4.hh
    if (*end == '.'){

  but I found here that the end ="NULL" and it doesn't meet if (*end !='0' && 
end != NULL ), so then it went to line 23 : throw BadConversion(typeid(Type).name(), c_str(), end 
- str, len );

That is just the reason why I should catch the BadConversion, but I don't like to do it because it changes the code executing routine, what I expect is to when the filed is NULL, just set it to 0(for number filed), just like the mysql++ in Visual studio. I am surprised at this because it behaves different in Visual studio and gcc.



The problem is that VC++ version is still 1.7.1 and that bug is fixed before 1.7.9.

A  solution is to change it manually in 1.7.1.

--

Sincerely,

--
For technical support contracts, go to https://order.mysql.com/?ref=msmi
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Mr. Sinisa Milivojevic <sinisa@xxxxxxxxx>
 / /|_/ / // /\ \/ /_/ / /__   MySQL AB
/_/  /_/\_, /___/\___\_\___/   Full time Developer and Support Coordinator
       <___/   www.mysql.com   Larnaca, Cyprus


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:    
http://lists.mysql.com/plusplus?unsub=gcdmc-plusplus@xxxxxxxxxxx





Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>