Altynbek Nurtaza
09/19/2024, 5:38 PMError code: 8, message: attempt to write a readonly database
. Does anybody know how to fix it?Altynbek Nurtaza
09/19/2024, 5:39 PMandroidx.sqlite.SQLiteException: Error code: 8, message: attempt to write a readonly database
kfun:kotlin.Throwable#<init>(kotlin.String?){} + 119
kfun:kotlin.Exception#<init>(kotlin.String?){} + 115
kfun:kotlin.RuntimeException#<init>(kotlin.String?){} + 115
kfun:androidx.sqlite.SQLiteException#<init>(kotlin.String){} + 95
kfun:androidx.sqlite#throwSQLiteException(kotlin.Int;kotlin.String?){}kotlin.Nothing + 579
kfun:androidx.sqlite.driver.NativeSQLiteStatement#step(){}kotlin.Boolean + 311
kfun:androidx.sqlite.SQLiteStatement#step(){}kotlin.Boolean-trampoline + 91
kfun:androidx.sqlite#execSQL__at__androidx.sqlite.SQLiteConnection(kotlin.String){} + 247
kfun:androidx.room.coroutines.PooledConnectionImpl.$beginTransactionCOROUTINE$7.invokeSuspend#internal + 1347
kfun:androidx.room.coroutines.PooledConnectionImpl.beginTransaction#internal + 307
kfun:androidx.room.coroutines.PooledConnectionImpl.$transactionCOROUTINE$6.invokeSuspend#internal + 903
kfun:androidx.room.coroutines.PooledConnectionImpl.transaction#internal + 343
kfun:androidx.room.coroutines.PooledConnectionImpl.withTransaction#internal + 555
kfun:androidx.room.Transactor#withTransaction#suspend(androidx.room.Transactor.SQLiteTransactionType;kotlin.coroutines.SuspendFunction1<androidx.room.TransactionScope<0:0>,0:0>;kotlin.coroutines.Continuation<0:0>){0§<kotlin.Any?>}kotlin.Any?-trampoline + 123
kfun:androidx.room#immediateTransaction#suspend__at__androidx.room.Transactor(kotlin.coroutines.SuspendFunction1<androidx.room.TransactionScope<0:0>,0:0>;kotlin.coroutines.Continuation<0:0>){0§<kotlin.Any?>}kotlin.Any? + 215
kfun:androidx.room.paging.CommonLimitOffsetImpl.initialLoad$lambda$4#internal + 339
kfun:androidx.room.paging.CommonLimitOffsetImpl.$initialLoad$lambda$4$FUNCTION_REFERENCE$2.invoke#internal + 139
kfun:kotlin.coroutines.SuspendFunction1#invoke#suspend(1:0;kotlin.coroutines.Continuation<1:1>){}kotlin.Any?-trampoline + 115
kfun:androidx.room.coroutines.ConnectionPoolImpl.useConnection$lambda$5#internal + 231
kfun:androidx.room.coroutines.ConnectionPoolImpl.$useConnection$lambda$5$FUNCTION_REFERENCE$7.invoke#internal + 139
kfun:kotlin.Function2#invoke(1:0;1:1){}1:2-trampoline + 115
kfun:kotlinx.coroutines.intrinsics#startUndispatchedOrReturn__at__kotlinx.coroutines.internal.ScopeCoroutine<0:0>(0:1;kotlin.coroutines.SuspendFunction1<0:1,0:0>){0§<kotlin.Any?>;1§<kotlin.Any?>}kotlin.Any? + 747
kfun:kotlinx.coroutines#withContext#suspend(kotlin.coroutines.CoroutineContext;kotlin.coroutines.SuspendFunction1<kotlinx.coroutines.CoroutineScope,0:0>;kotlin.coroutines.Continuation<0:0>){0§<kotlin.Any?>}kotlin.Any? + 1051
kfun:androidx.room.coroutines.ConnectionPoolImpl.$useConnectionCOROUTINE$0.invokeSuspend#internal + 5167
kfun:androidx.room.coroutines.ConnectionPoolImpl#useConnection#suspend(kotlin.Boolean;kotlin.coroutines.SuspendFunction1<androidx.room.Transactor,0:0>;kotlin.coroutines.Continuation<0:0>){0§<kotlin.Any?>}kotlin.Any? + 335
kfun:androidx.room.coroutines.ConnectionPool#useConnection#suspend(kotlin.Boolean;kotlin.coroutines.SuspendFunction1<androidx.room.Transactor,0:0>;kotlin.coroutines.Continuation<0:0>){0§<kotlin.Any?>}kotlin.Any?-trampoline + 127
kfun:androidx.room.RoomConnectionManager#useConnection#suspend(kotlin.Boolean;kotlin.coroutines.SuspendFunction1<androidx.room.Transactor,0:0>;kotlin.coroutines.Continuation<0:0>){0§<kotlin.Any?>}kotlin.Any? + 223
kfun:androidx.room.RoomDatabase#useConnection#suspend(kotlin.Boolean;kotlin.coroutines.SuspendFunction1<androidx.room.Transactor,0:0>;kotlin.coroutines.Continuation<0:0>){0§<kotlin.Any?>}kotlin.Any? + 223
kfun:androidx.room.useReaderConnection$lambda$0#internal + 147
kfun:androidx.room.$useReaderConnection$lambda$0$FUNCTION_REFERENCE$0.invoke#internal + 139
kfun:kotlin.Function2#invoke(1:0;1:1){}1:2-trampoline + 115
kfun:kotlin.coroutines.intrinsics.object-4.invokeSuspend#internal + 739
kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#invokeSuspend(kotlin.Result<kotlin.Any?>){}kotlin.Any?-trampoline + 71
kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 647
kfun:kotlin.coroutines.Continuation#resumeWith(kotlin.Result<1:0>){}-trampoline + 99
kfun:kotlinx.coroutines.DispatchedTask#run(){} + 1959
kfun:kotlinx.coroutines.Runnable#run(){}-trampoline + 91
kfun:kotlinx.coroutines.internal.LimitedDispatcher.Worker.run#internal + 231
kfun:kotlinx.coroutines.Runnable#run(){}-trampoline + 91
kfun:kotlinx.coroutines.MultiWorkerDispatcher.$workerRunLoop$lambda$2COROUTINE$0.invokeSuspend#internal + 2183
kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#invokeSuspend(kotlin.Result<kotlin.Any?>){}kotlin.Any?-trampoline + 71
kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 647
kfun:kotlin.coroutines.Continuation#resumeWith(kotlin.Result<1:0>){}-trampoline + 99
kfun:kotlinx.coroutines.DispatchedTask#run(){} + 1959
kfun:kotlinx.coroutines.Runnable#run(){}-trampoline + 91
kfun:kotlinx.coroutines.EventLoopImplBase#processNextEvent(){}kotlin.Long + 291
kfun:kotlinx.coroutines.EventLoop#processNextEvent(){}kotlin.Long-trampoline + 55
kfun:kotlinx.coroutines.BlockingCoroutine.joinBlocking#internal + 435
kfun:kotlinx.coroutines#runBlocking(kotlin.coroutines.CoroutineContext;kotlin.coroutines.SuspendFunction1<kotlinx.coroutines.CoroutineScope,0:0>){0§<kotlin.Any?>}0:0 + 1455
kfun:kotlinx.coroutines#runBlocking$default(kotlin.coroutines.CoroutineContext?;kotlin.coroutines.SuspendFunction1<kotlinx.coroutines.CoroutineScope,0:0>;<http://kotlin.Int|kotlin.Int>){0§<kotlin.Any?>}0:0 + 255
kfun:kotlinx.coroutines.MultiWorkerDispatcher.workerRunLoop#internal + 195
kfun:kotlinx.coroutines.MultiWorkerDispatcher.<init>$lambda$1$lambda$0#internal + 67
kfun:kotlinx.coroutines.MultiWorkerDispatcher.$<init>$lambda$1$lambda$0$FUNCTION_REFERENCE$5.invoke#internal + 71
kfun:kotlinx.coroutines.MultiWorkerDispatcher.$<init>$lambda$1$lambda$0$FUNCTION_REFERENCE$5.$<bridge-DNN>invoke(){}#internal + 71
kfun:kotlin.Function0#invoke(){}1:0-trampoline + 99
WorkerLaunchpad + 135
_ZN6Worker19processQueueElementEb + 2587
_ZN12_GLOBAL__N_113workerRoutineEPv + 191
_pthread_start + 103
thread_start + 7
Altynbek Nurtaza
09/19/2024, 5:45 PM@Query(
"SELECT * FROM client" +
" WHERE (name LIKE '%' || :query || '%' OR phone LIKE '%' || :query || '%')" +
" AND company_id = :companyId" +
" ORDER BY name ASC"
)
fun findByQuery(query: String, companyId: Int): PagingSource<Int, ClientEntity>
generated implementation:
public override fun findByQuery(query: String, companyId: Int): PagingSource<Int, ClientEntity> {
val _sql: String =
"SELECT * FROM client WHERE (name LIKE '%' || ? || '%' OR phone LIKE '%' || ? || '%') AND company_id = ? ORDER BY name ASC"
val _rawQuery: RoomRawQuery = RoomRawQuery(_sql) { _stmt ->
var _argIndex: Int = 1
_stmt.bindText(_argIndex, query)
_argIndex = 2
_stmt.bindText(_argIndex, query)
_argIndex = 3
_stmt.bindLong(_argIndex, companyId.toLong())
}
return object : LimitOffsetPagingSource<ClientEntity>(_rawQuery, __db, "client") {
protected override fun convertRows(statement: SQLiteStatement, itemCount: Int):
List<ClientEntity> {
_rawQuery.getBindingFunction().invoke(statement)
val _cursorIndexOfCompanyId: Int = getColumnIndexOrThrow(statement, "company_id")
val _cursorIndexOfPhone: Int = getColumnIndexOrThrow(statement, "phone")
val _cursorIndexOfName: Int = getColumnIndexOrThrow(statement, "name")
val _cursorIndexOfDiscount: Int = getColumnIndexOrThrow(statement, "discount")
val _cursorIndexOfStatus: Int = getColumnIndexOrThrow(statement, "status")
val _result: MutableList<ClientEntity> = mutableListOf()
while (statement.step()) {
val _item: ClientEntity
val _tmpCompanyId: Int
_tmpCompanyId = statement.getLong(_cursorIndexOfCompanyId).toInt()
val _tmpPhone: String
_tmpPhone = statement.getText(_cursorIndexOfPhone)
val _tmpName: String?
if (statement.isNull(_cursorIndexOfName)) {
_tmpName = null
} else {
_tmpName = statement.getText(_cursorIndexOfName)
}
val _tmpDiscount: Int?
if (statement.isNull(_cursorIndexOfDiscount)) {
_tmpDiscount = null
} else {
_tmpDiscount = statement.getLong(_cursorIndexOfDiscount).toInt()
}
val _tmpStatus: String?
if (statement.isNull(_cursorIndexOfStatus)) {
_tmpStatus = null
} else {
_tmpStatus = statement.getText(_cursorIndexOfStatus)
}
_item = ClientEntity(_tmpCompanyId,_tmpPhone,_tmpName,_tmpDiscount,_tmpStatus)
_result.add(_item)
}
return _result
}
}
}
danysantiago
09/19/2024, 8:02 PMAltynbek Nurtaza
09/19/2024, 9:01 PM