From: Warren Young Date: March 11 2005 4:45am Subject: Re: Minor problem with the resetdb List-Archive: http://lists.mysql.com/plusplus/4107 Message-Id: <42312266.3050000@etr-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Earl Miles wrote: > After the exceptions change there's a minor failure in the resetdb.cpp > that fails to check for an exception if it is unable to create the > sample database (which seems like a very common early error). Simply > adding a try/catch around that bit fixes it. Sorry, Earl, this patch misses the entire point of that change. On some platforms, nested exception handlers don't work. If an exception is thrown from within a catch block, the program segfaults, even if it is within a second catch block. You're right, though, that a problem would occur if the second select_db() call threw an exception. To fix this, I've added disable_exceptions() and restore_exceptions() methods to the Connection class. Note that these functions still work if throw_exceptions is false initially, since the restore call just returns to the previous value; it is not "enable_exceptions()". > Here's the diff, sent as an > attachment to prevent my mailer from word-wrapping it and destroying the > diff. Thanks for the effort, but it still got mangled. Line endings were DOS (may be my mailer's fault, though I don't know why it would mess with an attachment) and tabs were converted to spaces. I was still able to apply it, but to prevent hassle in the future, I'd appreciate it if you could see if either of these problems are something you can fix on your end. Also, in one place you put a curly brace on the following line instead of using K&R brace style, as the rest of the program uses. Please try to maintain whatever style you see nearby when changing the code, no matter how ugly it appears to you. :) I'm aware that the code style is not consistent; I'm in the process of converting it piece by piece, as I touch each file.