-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Port the SQL parser from PDO #4397
Conversation
7518a0a
to
5f07baf
Compare
f3d2380
to
d0f0e8d
Compare
TL;DR The new parser is ~2.5 times slower than the old one (80μs vs. 30μs per query on synthetic tests). Testing Methodology (gist):
Additional Considerations:
|
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.
Should this come with changes under docs
? Maybe an explanation on why the DBAL needs to have an SQL Parser, what features it allows us to implement?
I agree it would be a good addition but I don't think it's required for this PR to be accepted. The parser is not a user-facing API, so they normally don't have to know of its existence. I'd rather work on documenting it independently. |
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 performed a better search than I did before and found that this is actually already documented in https://github.com/doctrine/dbal/blob/3.0.x/docs/en/reference/data-retrieval-and-manipulation.rst#list-of-parameters-conversion
Approving just in case, but please proofread it for anything that should be changed.
Thanks for digging in. I don't see any mismatch between the new implementation and the current documentation. Except perhaps "a very powerful parsing process" which is now "an even more powerful parsing process". |
A parsing process the likes of which you've never seen, frankly it's the best out there, everyone says it is! |
… SqlParametersFlattener - the original method is not available anymore (it has been moved to Connection and made private) in the new version of doctrine/dbal - see doctrine/dbal#4397
… SqlParametersFlattener - the original method is not available anymore (it has been moved to Connection and made private) in the new version of doctrine/dbal - see doctrine/dbal#4397
… SqlParametersFlattener - the original method is not available anymore (it has been moved to Connection and made private) in the new version of doctrine/dbal - see doctrine/dbal#4397
… SqlParametersFlattener - the original method is not available anymore (it has been moved to Connection and made private) in the new version of doctrine/dbal - see doctrine/dbal#4397
… SqlParametersFlattener - the original method is not available anymore (it has been moved to Connection and made private) in the new version of doctrine/dbal - see doctrine/dbal#4397
… SqlParametersFlattener - the original method is not available anymore (it has been moved to Connection and made private) in the new version of doctrine/dbal - see doctrine/dbal#4397
Fixes: #4383
Additional Advantages:
Apart from fixing the issue with parsing comments, the new parser has the following advantages:
TODO:
Test escapingLooks like SQL Server doesn't know how to handle them itself:]
in SQL Server identifiers.Somehow PDO gets away with this. Otherwise, the Parser API will have to be declared public as a dependency of the Platform API.No. In fact, it's a bug (#80340).Rework the internal API of the wrapper Connection. ThisThis looks like too big of a change to make as part of this one. There's a lot of duplicated logic: logging, binding DBAL types, etc. that needs taking care of.@return array{0: …, 1: …, 2: …}
looks ugly.