fix(es_extended/server/functions): persist items added via AddItems - #1813
Closed
seltonmt012 wants to merge 1 commit into
Closed
fix(es_extended/server/functions): persist items added via AddItems#1813seltonmt012 wants to merge 1 commit into
seltonmt012 wants to merge 1 commit into
Conversation
MySQL.prepare.await batch mode expects an array of positional parameter arrays, but toInsert holds keyed tables, so the placeholders received no values and the INSERT silently did nothing. Items still showed up in-game because ESX.Items was populated from the keyed tables, but nothing was written to the items table. Build a positional parameters array for the prepared insert. Closes esx-framework#1768
Author
|
Got an answer on Discord: contributions should target the branch that becomes the next release, so |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ESX.AddItems adds the items to ESX.Items but they never end up in the database.
MySQL.prepare batch mode wants an array of positional parameter arrays, but toInsert is a list of keyed tables, so the ? placeholders get nothing and the INSERT silently does nothing. In-game it looks fine because ESX.Items is filled from the same keyed tables, but after a restart the items are gone since they were never saved.
Fixed by building a positional parameters array before the prepared insert.
Tested locally on artifact 25770 with MariaDB: added an item through AddItems and confirmed the row is now written to the items table.
Closes #1768