List:MySQL++« Previous MessageNext Message »
From:cgifalco Date:November 23 2004 6:48pm
Subject:Re: Segmentation fault
View as plain text  
Warren Young wrote:

> cgifalco wrote:
>
>> Under version 1.7.23 is dbinfo.cc now OK, but fieldinf1.cc issues 
>> still segmentation fault.
>
>
> Send a backtrace and the program's output.
>
I tested this program more carefully and here is what I found.
If I left the program unchanged the output is
[root@localhost examples]# ./fieldinf1 Query: select * from stock
Records Found: 5

Query Info:
Segmentation fault

If I comment these lines
//                    << setw(15) << res.types(i).sql_name() //line 40
//                    << setw(20) << res.types(i).name()  //line 43
the output is
[root@localhost examples]# ./fieldinf1 Query: select * from stock
Records Found: 5

Query Info:
0 item
1 num
2 weight
3 price
4 sdate

Segmentation fault

and if I change
       if (res.types(0) == typeid(string)) { //line 49
to
       if (res.types(0).base_type() == typeid(string)) {
and
       if (res.types(1) == typeid(longlong)) { //line 56
to
       if (res.types(1).base_type() == typeid(double)) {
then there is this output
[root@localhost examples]# ./fieldinf1 Query: select * from stock
Records Found: 5

Query Info:
0 item
1 num
2 weight
3 price
4 sdate

Field 'num' is of an SQL type which most closely resembles
C++ long long int type

If I uncomment after all these changes
                   << setw(15) << res.types(i).sql_name() //line 40
now the output is
[root@localhost examples]# ./fieldinf1 Query: select * from stock
Records Found: 5

Query Info:
0 item           [root@localhost examples]#

cgifalco

Thread
Segmentation faultcgifalco20 Nov
  • Re: Segmentation faultWarren Young21 Nov
    • Re: Segmentation faultcgifalco21 Nov
      • Re: Segmentation faultWarren Young22 Nov
        • Re: Segmentation faultcgifalco23 Nov
          • Re: Segmentation faultWarren Young23 Nov
            • Re: Segmentation faultcgifalco24 Nov