-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drop custom DBAL exceptions #245
Conversation
* Prepares an SQL statement. | ||
* | ||
* @param string $statement The SQL statement to prepare. | ||
* @throws DBALException | ||
* @return PDOStatement The prepared statement. | ||
* @return Statement The prepared statement. | ||
*/ | ||
public function prepare($statement) | ||
{ | ||
$this->connect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In parent, connect is not called. Is it here because of custom exception? Can I drop it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is indeed unneccesary. It was here only because older version of doctrine had it.
There is a bit of a problem with this. The panel and exception renderer require to know which connection generated the exception. Because for rendering of the exception, the So those methods that you've removed from public function executeQuery($query, array $params = array(), $types = array(), QueryCacheProfile $qcp = NULL)
{
try {
return parent::executeQuery($query, $params, $types, $qcp);
} catch (\Exception $e) {
if ($this->panel) {
$this->panel->queryFailed($e);
}
throw $e;
}
} This way, the custom exceptions are gone, but we still can bind the exception with the relevant connection object. And as the
That way, we can register the second and third one in production without the first one. The "context exceptions panel" must also be somehow passed to connection, so connection can mark the exceptions, and also passed to the custom Does it make sense? Also, it would be beneficial to look first how symfony is solving this - if they ignore the problem completely, or if they somehow mark the exceptions too. |
I wouldn't wanna drop the filling parameters back into the SQL, because I consider it way too comfortable, to be able to just copy the SQL statement and run it directly in Adminer. |
@fprochazka I expected it wouldn't be that simple. I try to rework it. That do you meant by your last comment? |
@foxycode well, there is always an option to simply drop the support for rendering SQL queries with parameters inlined, but I wouldn't wanna do that. |
@fprochazka Ok, I understand. But wouldn't be simplier remove panel from this repo and move work to new repository now? |
@foxycode I don't see how it would make it simpler :) The panel itself and context-free bluescreen renderers could in fact be separated right now probably, but the "exceptions bluescreen" would have to stay here, with the extended connection, since there would be no way otherwise to mark the exceptions |
@fprochazka I was thinking about separating Tracy integration including extended connection to separate package, but now I see it's not that good idea. I'll think about this more a try to fix it. |
@fprochazka I start with Panel reworking in separate PR. Can you please answer to other questions I had in code? |
I belive I've answered all your questions now :) |
6ac82e7
to
06fd1e8
Compare
Related to #238
This was little difficult for me. I am not sure about few things. See my comments in code.