Skip to content
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

Fixed deleting entities from lists with special characters #6561

Open
wants to merge 2 commits into
base: v2024.3.x
Choose a base branch
from

Conversation

grzesiek2010
Copy link
Member

@grzesiek2010 grzesiek2010 commented Jan 13, 2025

Closes #6559

Why is this the best possible solution? Were any other approaches considered?

We need to quote the list name to make it possible to use special characters in table names in SQL. It's not the first issue like that so this approach is the same as it was before in the case of similar problems.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

We’ve encountered issues with handling special characters in entities in other areas before, so this isn’t a new problem. Please test it as described in the issue (deleting entities), but keep in mind that this might not be the last case we’ll need to address.

Do we need any specific form for testing your changes? If so, please attach one.

Any form with entities where lists contain special characters like . or -.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

No.

Before submitting this PR, please make sure you have:

  • added or modified tests for any new or changed behavior
  • run ./gradlew connectedAndroidTest (or ./gradlew testLab) and confirmed all checks still pass
  • added a comment above any new strings describing it for translators
  • added any new strings with date formatting to DateFormatsTest
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.
  • verified that any new UI elements use theme colors. UI Components Style guidelines

@grzesiek2010 grzesiek2010 requested a review from seadowg January 13, 2025 17:34
@grzesiek2010 grzesiek2010 marked this pull request as ready for review January 13, 2025 17:34
Copy link
Member

@seadowg seadowg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should target v2024.3.x instead of master as we want to put it out as a hotfix.

@grzesiek2010 grzesiek2010 changed the base branch from master to v2024.3.x January 14, 2025 12:25
@grzesiek2010 grzesiek2010 requested a review from seadowg January 14, 2025 12:26
@grzesiek2010
Copy link
Member Author

This should target v2024.3.x instead of master as we want to put it out as a hotfix.

Fixed.

repository.save("wines.x", leoville)
repository.save("wines-x", leoville)

repository.delete("1")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me realize that delete should probably take a list as an arg as well, but that's for another time!

@@ -198,7 +198,7 @@ class DatabaseEntitiesRepository(context: Context, dbPath: String) : EntitiesRep
databaseConnection.withConnection {
getLists().forEach {
writableDatabase.delete(
it,
"`$it`",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to use backticks here instead of quotes like in the rest of the file?

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.

Crash when updating entities for list with special characters
2 participants