20 messages in com.mysql.lists.plusplusRe: exception when the field's value ...
FromSent OnAttachments
Reeza Awoodun28 Mar 2004 03:59 
Sinisa Milivojevic29 Mar 2004 03:44 
Tommy Tang30 Mar 2004 18:21 
Sinisa Milivojevic31 Mar 2004 02:39 
Tommy Tang31 Mar 2004 04:28 
Tommy Tang31 Mar 2004 04:55 
Jae Joo31 Mar 2004 06:14 
Tommy Tang31 Mar 2004 17:32 
Sinisa Milivojevic01 Apr 2004 02:41 
Sinisa Milivojevic01 Apr 2004 02:42 
Tommy Tang01 Apr 2004 03:56 
Sinisa Milivojevic01 Apr 2004 04:05 
Tommy Tang15 Apr 2004 03:37 
Jae Joo15 Apr 2004 06:26 
Tommy Tang15 Apr 2004 17:32 
Sinisa Milivojevic19 Apr 2004 10:44 
Tommy Tang19 Apr 2004 18:32 
Sinisa Milivojevic20 Apr 2004 02:52 
tommy20 Apr 2004 03:01 
Sinisa Milivojevic20 Apr 2004 04:24 
Subject:Re: exception when the field's value is NULL
From:Sinisa Milivojevic (sin@mysql.com)
Date:04/19/2004 10:44:47 AM
List:com.mysql.lists.plusplus

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,