![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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. |
|
Here's the diff, sent as an attachment to prevent my mailer from word-wrapping it and destroying the diff. |
I'm aware that the code style is
#3
| |||
| |||
|
|
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 isnot consistent; I'm in the process of converting it piece by piece, as I touch each file. |
#4
| |||
| |||
|
|
Line endings were DOS (may be my mailer's fault, though I don't know why it would mess with an attachment) |
#5
| |||
| |||
|
|
You're right, though, that a problem would occur if the second select_db() call threw an exception. |
#6
| |||
| |||
|
|
Warren Young wrote: You're right, though, that a problem would occur if the second select_db() call threw an exception. Turns out, this is extremely unlikely to occur. For it to happen, create_db() -- which doesn't throw exceptions -- would have to succeed, and then select_db() on the newly created database would have to fail. I wouldn't be surprised if MySQL's security is fine-grained enough that you could make a user that can create databases but not be able to select them, but why would someone do such a thing? I've withdrawn that change because it breaks the ABI, pointlessly. |
#7
| |||
| |||
|
|
Hmm. In the instance I was toying with, the db already existed from a previous run, and I was using the default user, who didn't have permission with the database, so that's exactly what was happening in my runs of resetdb. |
#8
| |||
| |||
|
|
Earl Miles wrote: Hmm. In the instance I was toying with, the db already existed from a previous run, and I was using the default user, who didn't have permission with the database, so that's exactly what was happening in my runs of resetdb. I think you need to debug that more closely. If the first select_db() fails, it will try to create_db, which _doesn't throw exceptions_ when it fails. It just returns true (!) so the program ends. |
perator+<char, std::char_traits<char>, std::allocator<char> >(char
#9
| |||
| |||
|
|
I think you are mistaken. |

|
The second would be to set a flag in the catch block, and once the catch block is exited, check that flag and execute the code that is currently in the catch block. Possibly a bit kludgy, but possibly safer than simply disabling exceptions entirely, depending on whether or not my concerns are valid. |
![]() |
| Thread Tools | |
| Display Modes | |
| |