Skip to content

Fixed Selection::insert spoiling PDO:lastInsertId - #217

Merged
dg merged 4 commits into
nette:masterfrom
Stopka:master
Feb 8, 2019
Merged

Fixed Selection::insert spoiling PDO:lastInsertId#217
dg merged 4 commits into
nette:masterfrom
Stopka:master

Conversation

@Stopka

@Stopka Stopka commented Feb 6, 2019

Copy link
Copy Markdown
Contributor

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

dg commented Feb 7, 2019

Copy link
Copy Markdown
Member

Great. Can you add a test?

@Stopka

Stopka commented Feb 8, 2019

Copy link
Copy Markdown
Contributor Author

Ok, I added test covering this bug.

@dg

dg commented Feb 8, 2019

Copy link
Copy Markdown
Member

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