Skip to content

Conversation

@Stopka
Copy link
Contributor

@Stopka Stopka commented Feb 6, 2019

Changes the order of method calls in Selection::insert, so that getPrimarySequence and getPrimaryAutoincrementKey methods are called before actual query. Without this edit calling of these methods can spoil PDO:lastInsertId by database query for building Structure cache, which results in not obtaining new inserted ActiveRow.
This fail usualy happened on first insert query when used with StaticConvetions.

@dg
Copy link
Member

dg commented Feb 7, 2019

Great. Can you add a test?

@Stopka
Copy link
Contributor Author

Stopka commented Feb 8, 2019

Ok, I added test covering this bug.

@dg
Copy link
Member

dg commented Feb 8, 2019

Thanks!

@dg dg merged commit 2eb679f into nette:master Feb 8, 2019
zelenomodrypes pushed a commit to AppsDevTeam/database that referenced this pull request Mar 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Selection - insert with StaticConvetions spoils PDO::lastInsertId

2 participants