Fix: Crashes caused by tables' names

This commit is contained in:
machiav3lli 2021-11-09 23:36:50 +01:00
parent cc8e7b6ea3
commit f966630e8a
3 changed files with 14 additions and 14 deletions

View File

@ -30,8 +30,8 @@ const val ROW_MATCH_RANK = "match_rank"
const val ROW_REPOSITORY_NAME = "repository"
const val ROW_PRODUCT_NAME = "product"
const val ROW_CATEGORY_NAME = "category"
const val ROW_INSTALLED_NAME = "memory.installed"
const val ROW_LOCK_NAME = "memory.lock"
const val ROW_INSTALLED_NAME = "memory_installed"
const val ROW_LOCK_NAME = "memory_lock"
const val JOB_ID_SYNC = 1

View File

@ -10,7 +10,7 @@ import com.looker.droidify.entity.ProductItem
interface BaseDao<T> {
@Insert
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insert(vararg product: T)
@Update(onConflict = OnConflictStrategy.REPLACE)
@ -191,25 +191,25 @@ interface InstalledDao : BaseDao<Installed> {
}
}
@Query("SELECT * FROM `memory.installed` WHERE package_name = :packageName")
@Query("SELECT * FROM memory_installed WHERE package_name = :packageName")
fun get(packageName: String): Cursor
@Query("DELETE FROM 'memory.installed' WHERE package_name = :packageName")
@Query("DELETE FROM memory_installed WHERE package_name = :packageName")
fun delete(packageName: String)
}
@Dao
interface LockDao : BaseDao<Lock> {
@Query("DELETE FROM 'memory.lock' WHERE package_name = :packageName")
@Query("DELETE FROM memory_lock WHERE package_name = :packageName")
fun delete(packageName: String)
}
@Dao
interface ProductTempDao : BaseDao<ProductTemp> {
@get:Query("SELECT * FROM `product.temporary`")
@get:Query("SELECT * FROM temporary_product")
val all: Array<ProductTemp>
@Query("DELETE FROM `product.temporary`")
@Query("DELETE FROM temporary_product")
fun emptyTable()
@Insert
@ -249,9 +249,9 @@ interface ProductTempDao : BaseDao<ProductTemp> {
@Dao
interface CategoryTempDao : BaseDao<CategoryTemp> {
@get:Query("SELECT * FROM `category.temporary`")
@get:Query("SELECT * FROM temporary_category")
val all: Array<CategoryTemp>
@Query("DELETE FROM `category.temporary`")
@Query("DELETE FROM temporary_category")
fun emptyTable()
}

View File

@ -50,7 +50,7 @@ open class Product {
var data_item: ProductItem? = null
}
@Entity(tableName = "product.temporary")
@Entity(tableName = "temporary_product")
class ProductTemp : Product()
@Entity(tableName = "category", primaryKeys = ["repository_id", "package_name", "name"])
@ -60,10 +60,10 @@ open class Category {
var name = ""
}
@Entity(tableName = "category.temporary")
@Entity(tableName = "temporary_category")
class CategoryTemp : Category()
@Entity(tableName = "memory.installed")
@Entity(tableName = "memory_installed")
class Installed(pName: String = "") {
@PrimaryKey
var package_name = pName
@ -73,7 +73,7 @@ class Installed(pName: String = "") {
var signature = ""
}
@Entity(tableName = "memory.lock")
@Entity(tableName = "memory_lock")
class Lock {
@PrimaryKey
var package_name = ""