Skip to content

Conversation

@esentis
Copy link

@esentis esentis commented Dec 4, 2025

Tested with Xiaomi Mi Mix 2

Fix Android album query SQL ( DBUtils#getAssetPathList )

  • Previously, the selection string was concatenated without a separating space/parenthesis, generating invalid SQL like BUCKET_ID IS NOT NULLbucket_id IS NOT NULL … GROUP BY. On stricter OEM MediaStore implementations this caused SQLiteException: no such column: NULLbucket_id when loading albums.
  • Updated to build the selection as BUCKET_ID IS NOT NULL plus the filter clause, with proper spacing and grouping, eliminating the malformed column token.

Ensure valid sort clause for paging ( IDBUtils#getSortOrder )

  • When no explicit order was provided, the plugin emitted ORDER BY LIMIT … OFFSET …, which is invalid SQL and produced near "LIMIT": syntax error on some devices when paging assets.
  • Added a default order (DATE_ADDED DESC, DATE_MODIFIED DESC) before LIMIT/OFFSET, so paging queries are syntactically correct across devices.

…uction by providing a default ORDER BY clause when no filter option is specified.
Copy link
Member

@AlexV525 AlexV525 left a comment

Choose a reason for hiding this comment

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

@esentis Thanks for the catch. Could you add corresponding tests to ensure it works as desired? It would be helpful if you could make screen records to indicate how the previous implementation is not working and how the fix works. Additionally, consider adding a page as a regression tracker under https://github.com/fluttercandies/flutter_photo_manager/tree/main/example/lib/page/developer/issues_page

@esentis
Copy link
Author

esentis commented Dec 15, 2025

Ok it seems that the changes made with 3.8.3 fixed my issue so I'm closing this.

@esentis esentis closed this Dec 15, 2025
@esentis esentis deleted the fix/android_mediastore_sql_errors branch December 16, 2025 14:32
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.

2 participants