mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
make db queries involving paths case insensitive
This commit is contained in:
parent
85f478a7ef
commit
e6980596a2
2 changed files with 7 additions and 7 deletions
|
@ -17,12 +17,12 @@ interface DirectoryDao {
|
||||||
@Insert(onConflict = REPLACE)
|
@Insert(onConflict = REPLACE)
|
||||||
fun insertAll(directories: List<Directory>)
|
fun insertAll(directories: List<Directory>)
|
||||||
|
|
||||||
@Query("DELETE FROM directories WHERE path = :path")
|
@Query("DELETE FROM directories WHERE path = :path COLLATE NOCASE")
|
||||||
fun deleteDirPath(path: String)
|
fun deleteDirPath(path: String)
|
||||||
|
|
||||||
@Query("UPDATE OR REPLACE directories SET thumbnail = :thumbnail, media_count = :mediaCnt, last_modified = :lastModified, date_taken = :dateTaken, size = :size, media_types = :mediaTypes WHERE path = :path")
|
@Query("UPDATE OR REPLACE directories SET thumbnail = :thumbnail, media_count = :mediaCnt, last_modified = :lastModified, date_taken = :dateTaken, size = :size, media_types = :mediaTypes WHERE path = :path COLLATE NOCASE")
|
||||||
fun updateDirectory(path: String, thumbnail: String, mediaCnt: Int, lastModified: Long, dateTaken: Long, size: Long, mediaTypes: Int)
|
fun updateDirectory(path: String, thumbnail: String, mediaCnt: Int, lastModified: Long, dateTaken: Long, size: Long, mediaTypes: Int)
|
||||||
|
|
||||||
@Query("UPDATE directories SET thumbnail = :thumbnail, filename = :name, path = :newPath WHERE path = :oldPath")
|
@Query("UPDATE directories SET thumbnail = :thumbnail, filename = :name, path = :newPath WHERE path = :oldPath COLLATE NOCASE")
|
||||||
fun updateDirectoryAfterRename(thumbnail: String, name: String, newPath: String, oldPath: String)
|
fun updateDirectoryAfterRename(thumbnail: String, name: String, newPath: String, oldPath: String)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import com.simplemobiletools.gallery.models.Medium
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
interface MediumDao {
|
interface MediumDao {
|
||||||
@Query("SELECT filename, full_path, parent_path, last_modified, date_taken, size, type, is_favorite FROM media WHERE parent_path = :path")
|
@Query("SELECT filename, full_path, parent_path, last_modified, date_taken, size, type, is_favorite FROM media WHERE parent_path = :path COLLATE NOCASE")
|
||||||
fun getMediaFromPath(path: String): List<Medium>
|
fun getMediaFromPath(path: String): List<Medium>
|
||||||
|
|
||||||
@Query("SELECT filename, full_path, parent_path, last_modified, date_taken, size, type, is_favorite FROM media WHERE is_favorite = 1")
|
@Query("SELECT filename, full_path, parent_path, last_modified, date_taken, size, type, is_favorite FROM media WHERE is_favorite = 1")
|
||||||
|
@ -23,12 +23,12 @@ interface MediumDao {
|
||||||
@Insert(onConflict = REPLACE)
|
@Insert(onConflict = REPLACE)
|
||||||
fun insertAll(media: List<Medium>)
|
fun insertAll(media: List<Medium>)
|
||||||
|
|
||||||
@Query("DELETE FROM media WHERE full_path = :path")
|
@Query("DELETE FROM media WHERE full_path = :path COLLATE NOCASE")
|
||||||
fun deleteMediumPath(path: String)
|
fun deleteMediumPath(path: String)
|
||||||
|
|
||||||
@Query("UPDATE OR REPLACE media SET filename = :newFilename, full_path = :newFullPath, parent_path = :newParentPath WHERE full_path = :oldPath")
|
@Query("UPDATE OR REPLACE media SET filename = :newFilename, full_path = :newFullPath, parent_path = :newParentPath WHERE full_path = :oldPath COLLATE NOCASE")
|
||||||
fun updateMedium(oldPath: String, newParentPath: String, newFilename: String, newFullPath: String)
|
fun updateMedium(oldPath: String, newParentPath: String, newFilename: String, newFullPath: String)
|
||||||
|
|
||||||
@Query("UPDATE media SET is_favorite = :isFavorite WHERE full_path = :path")
|
@Query("UPDATE media SET is_favorite = :isFavorite WHERE full_path = :path COLLATE NOCASE")
|
||||||
fun updateFavorite(path: String, isFavorite: Boolean)
|
fun updateFavorite(path: String, isFavorite: Boolean)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue