-
-
Notifications
You must be signed in to change notification settings - Fork 944
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
[ticket/14463] Add Doctrine DBAL as a driver #5841
base: master
Are you sure you want to change the base?
Conversation
I have played with this a few months back aswell. |
* | ||
* @return void | ||
*/ | ||
private function iterate_backward() |
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.
As of now, this method is just horse shit mixed with snake oil, as fetch_all()
doesn't fetch all but all remaining rows from the current cursor position. The problem here is saving all rows (which is one option to actually support going backwards) would add some overhead on all queries. I'm not sure if breaking BC here would make more sense, as I guess this might be some functionality that is not used at all by anyone (certainly not by the core).
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.
IMHO if there is no good way to achieve this then don't. Especially if it's not even used in the core. We should however make sure to properly document this BC break, e.g. in the documentation. I can prepare a page for this (similar to how symfony is documenting those changes: https://github.com/symfony/symfony/blob/master/UPGRADE-5.0.md).
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.
The only solution I see is to store all fetched rows in the iterator. I doubt that there would be any other solution to this.
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.
Although we could reexecute the query as well when backward iteration is called for, thus only having any overhead when it is absolutely required.
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.
Is it not possible to save queries that are made per page in a protected property? This will also allow extensions to access SQL queries that are already made by the core, without having to rerun them if they're not cached.
For example saving the SQL queries in $queries
and all the SQL results in $results
.
protected $queries = [
0 => 'SELECT * FROM `phpbb_forums`',
];
protected $results = [
0 => [
0 => ['forum_id => 1', '...' => '...'],
],
];
So you can iterate over them and check before querying to see if it already exists.
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.
I don't think we would want to add any new features to this, as the goal here is to keep BC as much as possible. Also, if you re-execute a query, chances are it comes from the cache which should be much faster. Thirdly, extensions should not really execute the same queries as that data probably is accessible to them from somewhere.
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.
Well, that's not completely true as a lot of queries in the core are not cached and not accessible for extensions, if not in tedious ways. But it was just an idea.
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.
Extension authors can add events if they want to.
What I not fully understand, is that the idea was to 'nuke dbal' and to eventually get rid of the phpBB part all together. Wouldn't it then make more sense to nuke it completely. Namely, replacing phpBB DBAL with Doctrine DBAL and implementing a phpBB wrapper class (for BC) that can eventually be deprecated and removed, rather than keeping the phpBB DBAL and adding a Doctrine driver? |
That is exactly what this PR does. See the |
Ah, I kind of misinterpreted this PR. As you are indeed doing it. |
c22cbba
to
4fbc3a8
Compare
a82e441
to
6d1eb2d
Compare
PHPBB3-14463
PHPBB3-14463
7f63b9a
to
411b952
Compare
PHPBB3-14463
https://github.com/doctrine/dbal/search?p=1&q=getTruncateTableSQL&type=code In case you want to implement #5329 here |
This probably breaks all db tools etc, so it is mostly opened to gather feedback.
Checklist:
Tracker ticket (set the ticket ID to your ticket ID):
https://tracker.phpbb.com/browse/PHPBB3-14463