List:MySQL++« Previous MessageNext Message »
From:Jose Mortensen Date:September 23 2004 10:07pm
Subject:query.store, query.exec might yield in segmentation fault
View as plain text  
Some code like this

query << "drop table mytable";
Result res = query.store();
if (res.is_empty()) {
    do something ... or don't do something ...
}

Produces a segmentation fault at res.is_empty(). I think it should either throw an
exception or return a empty Result.

I know it should use exec instead, but:

1. C++ code should never produce a segmentation fault. Should produce at most an
exception.

2. In some cases like, for example, a user console program where the query is user
defined, it is difficult to predict if the query should return something or not. In cases
like that better to return an empty result. I think.


 In the opposite case, where a select is used with exec, it will yield in a out of sync
exception that can not been recovered in future query.store functions unless the
connection to the database is closed.


My preference is to return an empty result.
Thread
query.store, query.exec might yield in segmentation faultJose Mortensen24 Sep
  • Re: query.store, query.exec might yield in segmentation faultWarren Young24 Sep
  • RE: query.store, query.exec might yield in segmentation faultJose Mortensen29 Sep
Re: query.store, query.exec might yield in segmentation faultWarren Young24 Sep
RE: query.store, query.exec might yield in segmentation faultJo Ellen Brandmeyer24 Sep