-
-
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
Fix returning the proper last inserted id in MSSQL #3523
Fix returning the proper last inserted id in MSSQL #3523
Conversation
a10b812
to
2a08876
Compare
492f874
to
9bd8e85
Compare
…having to replicate the \PDOStatement interface in ResultStatement
456e5a8
to
79b93df
Compare
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 need @deeky666 to check this patch, since he initially authored #2648 (which was closed due to its high complexity/risk for little gain).
I'd say that also here the same applies: if a prepared statement is causing side-effects through stored procedures and triggers, I'd rather call the schema "foobar'd" and "needs to be fixed there" rather than trying to fix issues on this end.
10890d6
to
3836750
Compare
Summary
I discovered a problem when the table in MSSQL has a trigger with insert statements. Id returned by method lastInsertId is invalid. It isn't id from the table in where we were inserting data, but from the table that trigger was inserting data.
The problem concerns sqlsrv and pdo_sqlsrv extensions. The fix for sqlsrv was quite simple, I only added a few lines of code.
But the fix for pdo_sqlsrv required to rebuild the implementation of Connection and Statement. I made it similar to the sqlsrv implementation.