-
-
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
Throw exception from lastInsertId() if there is no identity value #4324
Conversation
4330d28
to
83e4265
Compare
@morozov Ready for discussion! |
7fa3308
to
b6f1c06
Compare
@morozov I'd like to come back to this. Before diving again in this PR, should I retarget |
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'd like to come back to this.
That would be awesome!
Before diving again in this PR, should I retarget
3.0.x
instead ofmaster
?
3.0.0
is already released.
Oh wow, I didn't expect it anytime soon. I had quite a few things I would have liked to propose for 3.0, but looks like they'll have to wait for 4.0 now. Any rough ETA on this one? I mean, can we expect it in a reasonable timeframe like a year from now, or will we have to wait for multiple years like Doctrine 2 to 3? |
@morozov Ready for review again. The main points that you may want to have a look at are:
|
@BenMorel thanks for the update. I've been short on time for OSS lately and I cannot promise I'll look at it immediately but I'll do as soon as I can. |
da1fd37
to
b3db903
Compare
@BenMorel, just FYI, I squashed and rebased your PR to accommodate the changes from #4691. This way, the scope of this PR boils down to changing the return type of I have a couple more ideas on improving the code, will document later. |
48580a2
to
f56c2c0
Compare
Co-authored-by: Sergei Morozov <morozov@tut.by>
f56c2c0
to
a32a18c
Compare
Thanks for the patch! |
Summary
Supersedes #3759 and #3368.
Proposed changes
This PR splits the existing
lastInsertId(?string $name = null): string
method into 2 methods:getLastInsertId() : int|string
getSequenceNumber(string $name): int|string
Tests have been extended to cover the following scenarios:
getLastInsertId()
on supported platformsgetLastInsertId()
on supported platforms, on a fresh connection, i.e. with no ID available (NoIdentityValue
exception)getLastInsertId()
on unsupported platforms (IdentityColumnsNotSupported
exception)getSequenceNumber()
with a known sequence name on supported platformsgetSequenceNumber()
with an unknown sequence name on supported platforms (SequenceDoesNotExist
exception)getSequenceNumber()
on unsupported platforms (SequencesNotSupported
exception)