Coverage Summary for Class: ClientsDao_Impl (com.imecatro.demosales.data.clients.datasource)
| Class |
Method, %
|
Branch, %
|
Line, %
|
Instruction, %
|
| ClientsDao_Impl |
0%
(0/33)
|
0%
(0/28)
|
0%
(0/293)
|
0%
(0/1148)
|
| ClientsDao_Impl$1 |
0%
(0/3)
|
0%
(0/4)
|
0%
(0/20)
|
0%
(0/80)
|
| ClientsDao_Impl$2 |
0%
(0/3)
|
|
0%
(0/8)
|
0%
(0/33)
|
| ClientsDao_Impl$3 |
0%
(0/3)
|
0%
(0/4)
|
0%
(0/21)
|
0%
(0/85)
|
| ClientsDao_Impl$Companion |
0%
(0/1)
|
|
0%
(0/1)
|
0%
(0/1)
|
| Total |
0%
(0/43)
|
0%
(0/36)
|
0%
(0/343)
|
0%
(0/1347)
|
package com.imecatro.demosales.`data`.clients.datasource
import androidx.room.EntityDeleteOrUpdateAdapter
import androidx.room.EntityInsertAdapter
import androidx.room.RoomDatabase
import androidx.room.coroutines.createFlow
import androidx.room.util.getColumnIndexOrThrow
import androidx.room.util.performBlocking
import androidx.sqlite.SQLiteStatement
import com.imecatro.demosales.`data`.clients.model.ClientRoomEntity
import com.imecatro.demosales.`data`.clients.model.PurchaseRoomEntity
import javax.`annotation`.processing.Generated
import kotlin.Boolean
import kotlin.Double
import kotlin.Int
import kotlin.Long
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.MutableList
import kotlin.collections.mutableListOf
import kotlin.reflect.KClass
import kotlinx.coroutines.flow.Flow
@Generated(value = ["androidx.room.RoomProcessor"])
@Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION", "REMOVAL"])
public class ClientsDao_Impl(
__db: RoomDatabase,
) : ClientsDao {
private val __db: RoomDatabase
private val __insertAdapterOfClientRoomEntity: EntityInsertAdapter<ClientRoomEntity>
private val __insertAdapterOfPurchaseRoomEntity: EntityInsertAdapter<PurchaseRoomEntity>
private val __updateAdapterOfClientRoomEntity: EntityDeleteOrUpdateAdapter<ClientRoomEntity>
init {
this.__db = __db
this.__insertAdapterOfClientRoomEntity = object : EntityInsertAdapter<ClientRoomEntity>() {
protected override fun createQuery(): String = "INSERT OR REPLACE INTO `client_table` (`id`,`name`,`phone`,`address`,`imageUri`,`timestamp`,`tableVersion`,`latitude`,`longitude`,`accumulatedPurchases`,`isFavorite`) VALUES (nullif(?, 0),?,?,?,?,?,?,?,?,?,?)"
protected override fun bind(statement: SQLiteStatement, entity: ClientRoomEntity) {
statement.bindLong(1, entity.id)
statement.bindText(2, entity.name)
statement.bindText(3, entity.phone)
statement.bindText(4, entity.address)
statement.bindText(5, entity.imageUri)
statement.bindLong(6, entity.timestamp)
statement.bindText(7, entity.tableVersion)
val _tmpLatitude: Double? = entity.latitude
if (_tmpLatitude == null) {
statement.bindNull(8)
} else {
statement.bindDouble(8, _tmpLatitude)
}
val _tmpLongitude: Double? = entity.longitude
if (_tmpLongitude == null) {
statement.bindNull(9)
} else {
statement.bindDouble(9, _tmpLongitude)
}
statement.bindDouble(10, entity.accumulatedPurchases)
val _tmp: Int = if (entity.isFavorite) 1 else 0
statement.bindLong(11, _tmp.toLong())
}
}
this.__insertAdapterOfPurchaseRoomEntity = object : EntityInsertAdapter<PurchaseRoomEntity>() {
protected override fun createQuery(): String = "INSERT OR REPLACE INTO `purchases_table` (`id`,`purchaseNumber`,`client_id`,`description`,`amount`,`date`) VALUES (nullif(?, 0),?,?,?,?,?)"
protected override fun bind(statement: SQLiteStatement, entity: PurchaseRoomEntity) {
statement.bindLong(1, entity.id)
statement.bindText(2, entity.purchaseNumber)
statement.bindLong(3, entity.clientId)
statement.bindText(4, entity.description)
statement.bindDouble(5, entity.amount)
statement.bindLong(6, entity.date)
}
}
this.__updateAdapterOfClientRoomEntity = object : EntityDeleteOrUpdateAdapter<ClientRoomEntity>() {
protected override fun createQuery(): String = "UPDATE OR ABORT `client_table` SET `id` = ?,`name` = ?,`phone` = ?,`address` = ?,`imageUri` = ?,`timestamp` = ?,`tableVersion` = ?,`latitude` = ?,`longitude` = ?,`accumulatedPurchases` = ?,`isFavorite` = ? WHERE `id` = ?"
protected override fun bind(statement: SQLiteStatement, entity: ClientRoomEntity) {
statement.bindLong(1, entity.id)
statement.bindText(2, entity.name)
statement.bindText(3, entity.phone)
statement.bindText(4, entity.address)
statement.bindText(5, entity.imageUri)
statement.bindLong(6, entity.timestamp)
statement.bindText(7, entity.tableVersion)
val _tmpLatitude: Double? = entity.latitude
if (_tmpLatitude == null) {
statement.bindNull(8)
} else {
statement.bindDouble(8, _tmpLatitude)
}
val _tmpLongitude: Double? = entity.longitude
if (_tmpLongitude == null) {
statement.bindNull(9)
} else {
statement.bindDouble(9, _tmpLongitude)
}
statement.bindDouble(10, entity.accumulatedPurchases)
val _tmp: Int = if (entity.isFavorite) 1 else 0
statement.bindLong(11, _tmp.toLong())
statement.bindLong(12, entity.id)
}
}
}
public override fun addClient(client: ClientRoomEntity): Unit = performBlocking(__db, false, true) { _connection ->
__insertAdapterOfClientRoomEntity.insert(_connection, client)
}
public override fun addPurchase(purchase: PurchaseRoomEntity): Unit = performBlocking(__db, false, true) { _connection ->
__insertAdapterOfPurchaseRoomEntity.insert(_connection, purchase)
}
public override fun updateClient(product: ClientRoomEntity): Unit = performBlocking(__db, false, true) { _connection ->
__updateAdapterOfClientRoomEntity.handle(_connection, product)
}
public override fun cancelPurchaseAndRecalculate(purchaseNumber: String): Unit = performBlocking(__db, false, true) { _ ->
super@ClientsDao_Impl.cancelPurchaseAndRecalculate(purchaseNumber)
}
public override fun addPurchaseAndRecalculate(purchase: PurchaseRoomEntity): Unit = performBlocking(__db, false, true) { _ ->
super@ClientsDao_Impl.addPurchaseAndRecalculate(purchase)
}
public override fun getAllClients(): Flow<List<ClientRoomEntity>> {
val _sql: String = "SELECT * FROM client_table ORDER BY id"
return createFlow(__db, false, arrayOf("client_table")) { _connection ->
val _stmt: SQLiteStatement = _connection.prepare(_sql)
try {
val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
val _columnIndexOfName: Int = getColumnIndexOrThrow(_stmt, "name")
val _columnIndexOfPhone: Int = getColumnIndexOrThrow(_stmt, "phone")
val _columnIndexOfAddress: Int = getColumnIndexOrThrow(_stmt, "address")
val _columnIndexOfImageUri: Int = getColumnIndexOrThrow(_stmt, "imageUri")
val _columnIndexOfTimestamp: Int = getColumnIndexOrThrow(_stmt, "timestamp")
val _columnIndexOfTableVersion: Int = getColumnIndexOrThrow(_stmt, "tableVersion")
val _columnIndexOfLatitude: Int = getColumnIndexOrThrow(_stmt, "latitude")
val _columnIndexOfLongitude: Int = getColumnIndexOrThrow(_stmt, "longitude")
val _columnIndexOfAccumulatedPurchases: Int = getColumnIndexOrThrow(_stmt, "accumulatedPurchases")
val _columnIndexOfIsFavorite: Int = getColumnIndexOrThrow(_stmt, "isFavorite")
val _result: MutableList<ClientRoomEntity> = mutableListOf()
while (_stmt.step()) {
val _item: ClientRoomEntity
val _tmpId: Long
_tmpId = _stmt.getLong(_columnIndexOfId)
val _tmpName: String
_tmpName = _stmt.getText(_columnIndexOfName)
val _tmpPhone: String
_tmpPhone = _stmt.getText(_columnIndexOfPhone)
val _tmpAddress: String
_tmpAddress = _stmt.getText(_columnIndexOfAddress)
val _tmpImageUri: String
_tmpImageUri = _stmt.getText(_columnIndexOfImageUri)
val _tmpTimestamp: Long
_tmpTimestamp = _stmt.getLong(_columnIndexOfTimestamp)
val _tmpTableVersion: String
_tmpTableVersion = _stmt.getText(_columnIndexOfTableVersion)
val _tmpLatitude: Double?
if (_stmt.isNull(_columnIndexOfLatitude)) {
_tmpLatitude = null
} else {
_tmpLatitude = _stmt.getDouble(_columnIndexOfLatitude)
}
val _tmpLongitude: Double?
if (_stmt.isNull(_columnIndexOfLongitude)) {
_tmpLongitude = null
} else {
_tmpLongitude = _stmt.getDouble(_columnIndexOfLongitude)
}
val _tmpAccumulatedPurchases: Double
_tmpAccumulatedPurchases = _stmt.getDouble(_columnIndexOfAccumulatedPurchases)
val _tmpIsFavorite: Boolean
val _tmp: Int
_tmp = _stmt.getLong(_columnIndexOfIsFavorite).toInt()
_tmpIsFavorite = _tmp != 0
_item = ClientRoomEntity(_tmpId,_tmpName,_tmpPhone,_tmpAddress,_tmpImageUri,_tmpTimestamp,_tmpTableVersion,_tmpLatitude,_tmpLongitude,_tmpAccumulatedPurchases,_tmpIsFavorite)
_result.add(_item)
}
_result
} finally {
_stmt.close()
}
}
}
public override fun getClientDetailsById(id: Long): ClientRoomEntity {
val _sql: String = "SELECT * FROM client_table WHERE id = ? "
return performBlocking(__db, true, false) { _connection ->
val _stmt: SQLiteStatement = _connection.prepare(_sql)
try {
var _argIndex: Int = 1
_stmt.bindLong(_argIndex, id)
val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
val _columnIndexOfName: Int = getColumnIndexOrThrow(_stmt, "name")
val _columnIndexOfPhone: Int = getColumnIndexOrThrow(_stmt, "phone")
val _columnIndexOfAddress: Int = getColumnIndexOrThrow(_stmt, "address")
val _columnIndexOfImageUri: Int = getColumnIndexOrThrow(_stmt, "imageUri")
val _columnIndexOfTimestamp: Int = getColumnIndexOrThrow(_stmt, "timestamp")
val _columnIndexOfTableVersion: Int = getColumnIndexOrThrow(_stmt, "tableVersion")
val _columnIndexOfLatitude: Int = getColumnIndexOrThrow(_stmt, "latitude")
val _columnIndexOfLongitude: Int = getColumnIndexOrThrow(_stmt, "longitude")
val _columnIndexOfAccumulatedPurchases: Int = getColumnIndexOrThrow(_stmt, "accumulatedPurchases")
val _columnIndexOfIsFavorite: Int = getColumnIndexOrThrow(_stmt, "isFavorite")
val _result: ClientRoomEntity
if (_stmt.step()) {
val _tmpId: Long
_tmpId = _stmt.getLong(_columnIndexOfId)
val _tmpName: String
_tmpName = _stmt.getText(_columnIndexOfName)
val _tmpPhone: String
_tmpPhone = _stmt.getText(_columnIndexOfPhone)
val _tmpAddress: String
_tmpAddress = _stmt.getText(_columnIndexOfAddress)
val _tmpImageUri: String
_tmpImageUri = _stmt.getText(_columnIndexOfImageUri)
val _tmpTimestamp: Long
_tmpTimestamp = _stmt.getLong(_columnIndexOfTimestamp)
val _tmpTableVersion: String
_tmpTableVersion = _stmt.getText(_columnIndexOfTableVersion)
val _tmpLatitude: Double?
if (_stmt.isNull(_columnIndexOfLatitude)) {
_tmpLatitude = null
} else {
_tmpLatitude = _stmt.getDouble(_columnIndexOfLatitude)
}
val _tmpLongitude: Double?
if (_stmt.isNull(_columnIndexOfLongitude)) {
_tmpLongitude = null
} else {
_tmpLongitude = _stmt.getDouble(_columnIndexOfLongitude)
}
val _tmpAccumulatedPurchases: Double
_tmpAccumulatedPurchases = _stmt.getDouble(_columnIndexOfAccumulatedPurchases)
val _tmpIsFavorite: Boolean
val _tmp: Int
_tmp = _stmt.getLong(_columnIndexOfIsFavorite).toInt()
_tmpIsFavorite = _tmp != 0
_result = ClientRoomEntity(_tmpId,_tmpName,_tmpPhone,_tmpAddress,_tmpImageUri,_tmpTimestamp,_tmpTableVersion,_tmpLatitude,_tmpLongitude,_tmpAccumulatedPurchases,_tmpIsFavorite)
} else {
error("The query result was empty, but expected a single row to return a NON-NULL object of type 'com.imecatro.demosales.`data`.clients.model.ClientRoomEntity'.")
}
_result
} finally {
_stmt.close()
}
}
}
public override fun searchClients(clientName: String): Flow<List<ClientRoomEntity>> {
val _sql: String = "SELECT * FROM client_table WHERE name LIKE ? || '%'"
return createFlow(__db, false, arrayOf("client_table")) { _connection ->
val _stmt: SQLiteStatement = _connection.prepare(_sql)
try {
var _argIndex: Int = 1
_stmt.bindText(_argIndex, clientName)
val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
val _columnIndexOfName: Int = getColumnIndexOrThrow(_stmt, "name")
val _columnIndexOfPhone: Int = getColumnIndexOrThrow(_stmt, "phone")
val _columnIndexOfAddress: Int = getColumnIndexOrThrow(_stmt, "address")
val _columnIndexOfImageUri: Int = getColumnIndexOrThrow(_stmt, "imageUri")
val _columnIndexOfTimestamp: Int = getColumnIndexOrThrow(_stmt, "timestamp")
val _columnIndexOfTableVersion: Int = getColumnIndexOrThrow(_stmt, "tableVersion")
val _columnIndexOfLatitude: Int = getColumnIndexOrThrow(_stmt, "latitude")
val _columnIndexOfLongitude: Int = getColumnIndexOrThrow(_stmt, "longitude")
val _columnIndexOfAccumulatedPurchases: Int = getColumnIndexOrThrow(_stmt, "accumulatedPurchases")
val _columnIndexOfIsFavorite: Int = getColumnIndexOrThrow(_stmt, "isFavorite")
val _result: MutableList<ClientRoomEntity> = mutableListOf()
while (_stmt.step()) {
val _item: ClientRoomEntity
val _tmpId: Long
_tmpId = _stmt.getLong(_columnIndexOfId)
val _tmpName: String
_tmpName = _stmt.getText(_columnIndexOfName)
val _tmpPhone: String
_tmpPhone = _stmt.getText(_columnIndexOfPhone)
val _tmpAddress: String
_tmpAddress = _stmt.getText(_columnIndexOfAddress)
val _tmpImageUri: String
_tmpImageUri = _stmt.getText(_columnIndexOfImageUri)
val _tmpTimestamp: Long
_tmpTimestamp = _stmt.getLong(_columnIndexOfTimestamp)
val _tmpTableVersion: String
_tmpTableVersion = _stmt.getText(_columnIndexOfTableVersion)
val _tmpLatitude: Double?
if (_stmt.isNull(_columnIndexOfLatitude)) {
_tmpLatitude = null
} else {
_tmpLatitude = _stmt.getDouble(_columnIndexOfLatitude)
}
val _tmpLongitude: Double?
if (_stmt.isNull(_columnIndexOfLongitude)) {
_tmpLongitude = null
} else {
_tmpLongitude = _stmt.getDouble(_columnIndexOfLongitude)
}
val _tmpAccumulatedPurchases: Double
_tmpAccumulatedPurchases = _stmt.getDouble(_columnIndexOfAccumulatedPurchases)
val _tmpIsFavorite: Boolean
val _tmp: Int
_tmp = _stmt.getLong(_columnIndexOfIsFavorite).toInt()
_tmpIsFavorite = _tmp != 0
_item = ClientRoomEntity(_tmpId,_tmpName,_tmpPhone,_tmpAddress,_tmpImageUri,_tmpTimestamp,_tmpTableVersion,_tmpLatitude,_tmpLongitude,_tmpAccumulatedPurchases,_tmpIsFavorite)
_result.add(_item)
}
_result
} finally {
_stmt.close()
}
}
}
public override fun getClientByPhoneNumber(phoneNumber: String): ClientRoomEntity? {
val _sql: String = "SELECT * FROM client_table WHERE phone = ? LIMIT 1"
return performBlocking(__db, true, false) { _connection ->
val _stmt: SQLiteStatement = _connection.prepare(_sql)
try {
var _argIndex: Int = 1
_stmt.bindText(_argIndex, phoneNumber)
val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
val _columnIndexOfName: Int = getColumnIndexOrThrow(_stmt, "name")
val _columnIndexOfPhone: Int = getColumnIndexOrThrow(_stmt, "phone")
val _columnIndexOfAddress: Int = getColumnIndexOrThrow(_stmt, "address")
val _columnIndexOfImageUri: Int = getColumnIndexOrThrow(_stmt, "imageUri")
val _columnIndexOfTimestamp: Int = getColumnIndexOrThrow(_stmt, "timestamp")
val _columnIndexOfTableVersion: Int = getColumnIndexOrThrow(_stmt, "tableVersion")
val _columnIndexOfLatitude: Int = getColumnIndexOrThrow(_stmt, "latitude")
val _columnIndexOfLongitude: Int = getColumnIndexOrThrow(_stmt, "longitude")
val _columnIndexOfAccumulatedPurchases: Int = getColumnIndexOrThrow(_stmt, "accumulatedPurchases")
val _columnIndexOfIsFavorite: Int = getColumnIndexOrThrow(_stmt, "isFavorite")
val _result: ClientRoomEntity?
if (_stmt.step()) {
val _tmpId: Long
_tmpId = _stmt.getLong(_columnIndexOfId)
val _tmpName: String
_tmpName = _stmt.getText(_columnIndexOfName)
val _tmpPhone: String
_tmpPhone = _stmt.getText(_columnIndexOfPhone)
val _tmpAddress: String
_tmpAddress = _stmt.getText(_columnIndexOfAddress)
val _tmpImageUri: String
_tmpImageUri = _stmt.getText(_columnIndexOfImageUri)
val _tmpTimestamp: Long
_tmpTimestamp = _stmt.getLong(_columnIndexOfTimestamp)
val _tmpTableVersion: String
_tmpTableVersion = _stmt.getText(_columnIndexOfTableVersion)
val _tmpLatitude: Double?
if (_stmt.isNull(_columnIndexOfLatitude)) {
_tmpLatitude = null
} else {
_tmpLatitude = _stmt.getDouble(_columnIndexOfLatitude)
}
val _tmpLongitude: Double?
if (_stmt.isNull(_columnIndexOfLongitude)) {
_tmpLongitude = null
} else {
_tmpLongitude = _stmt.getDouble(_columnIndexOfLongitude)
}
val _tmpAccumulatedPurchases: Double
_tmpAccumulatedPurchases = _stmt.getDouble(_columnIndexOfAccumulatedPurchases)
val _tmpIsFavorite: Boolean
val _tmp: Int
_tmp = _stmt.getLong(_columnIndexOfIsFavorite).toInt()
_tmpIsFavorite = _tmp != 0
_result = ClientRoomEntity(_tmpId,_tmpName,_tmpPhone,_tmpAddress,_tmpImageUri,_tmpTimestamp,_tmpTableVersion,_tmpLatitude,_tmpLongitude,_tmpAccumulatedPurchases,_tmpIsFavorite)
} else {
_result = null
}
_result
} finally {
_stmt.close()
}
}
}
public override fun getPurchasesByClientId(id: Long): Flow<List<PurchaseRoomEntity>> {
val _sql: String = "SELECT * FROM purchases_table where client_id = ?"
return createFlow(__db, false, arrayOf("purchases_table")) { _connection ->
val _stmt: SQLiteStatement = _connection.prepare(_sql)
try {
var _argIndex: Int = 1
_stmt.bindLong(_argIndex, id)
val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
val _columnIndexOfPurchaseNumber: Int = getColumnIndexOrThrow(_stmt, "purchaseNumber")
val _columnIndexOfClientId: Int = getColumnIndexOrThrow(_stmt, "client_id")
val _columnIndexOfDescription: Int = getColumnIndexOrThrow(_stmt, "description")
val _columnIndexOfAmount: Int = getColumnIndexOrThrow(_stmt, "amount")
val _columnIndexOfDate: Int = getColumnIndexOrThrow(_stmt, "date")
val _result: MutableList<PurchaseRoomEntity> = mutableListOf()
while (_stmt.step()) {
val _item: PurchaseRoomEntity
val _tmpId: Long
_tmpId = _stmt.getLong(_columnIndexOfId)
val _tmpPurchaseNumber: String
_tmpPurchaseNumber = _stmt.getText(_columnIndexOfPurchaseNumber)
val _tmpClientId: Long
_tmpClientId = _stmt.getLong(_columnIndexOfClientId)
val _tmpDescription: String
_tmpDescription = _stmt.getText(_columnIndexOfDescription)
val _tmpAmount: Double
_tmpAmount = _stmt.getDouble(_columnIndexOfAmount)
val _tmpDate: Long
_tmpDate = _stmt.getLong(_columnIndexOfDate)
_item = PurchaseRoomEntity(_tmpId,_tmpPurchaseNumber,_tmpClientId,_tmpDescription,_tmpAmount,_tmpDate)
_result.add(_item)
}
_result
} finally {
_stmt.close()
}
}
}
public override fun getClientIdByPurchaseNumber(purchaseNumber: String): Long {
val _sql: String = "SELECT client_id FROM purchases_table WHERE purchaseNumber = ?"
return performBlocking(__db, true, false) { _connection ->
val _stmt: SQLiteStatement = _connection.prepare(_sql)
try {
var _argIndex: Int = 1
_stmt.bindText(_argIndex, purchaseNumber)
val _result: Long
if (_stmt.step()) {
_result = _stmt.getLong(0)
} else {
_result = 0L
}
_result
} finally {
_stmt.close()
}
}
}
public override fun deleteClientById(id: Long) {
val _sql: String = "DELETE FROM client_table WHERE id = ?"
return performBlocking(__db, false, true) { _connection ->
val _stmt: SQLiteStatement = _connection.prepare(_sql)
try {
var _argIndex: Int = 1
_stmt.bindLong(_argIndex, id)
_stmt.step()
} finally {
_stmt.close()
}
}
}
public override fun deletePurchaseByNumber(purchaseNumber: String) {
val _sql: String = "DELETE FROM purchases_table WHERE purchaseNumber = ?"
return performBlocking(__db, false, true) { _connection ->
val _stmt: SQLiteStatement = _connection.prepare(_sql)
try {
var _argIndex: Int = 1
_stmt.bindText(_argIndex, purchaseNumber)
_stmt.step()
} finally {
_stmt.close()
}
}
}
public override fun cancelPurchaseByNumber(purchaseNumber: String) {
val _sql: String = "UPDATE purchases_table SET description = description || '-Cancelled', amount = 0 WHERE purchaseNumber = ?"
return performBlocking(__db, false, true) { _connection ->
val _stmt: SQLiteStatement = _connection.prepare(_sql)
try {
var _argIndex: Int = 1
_stmt.bindText(_argIndex, purchaseNumber)
_stmt.step()
} finally {
_stmt.close()
}
}
}
public override fun recalculateAccumulatedPurchases(clientId: Long) {
val _sql: String = "UPDATE client_table SET accumulatedPurchases = (SELECT SUM(amount) FROM purchases_table WHERE client_id = ?) WHERE id = ?"
return performBlocking(__db, false, true) { _connection ->
val _stmt: SQLiteStatement = _connection.prepare(_sql)
try {
var _argIndex: Int = 1
_stmt.bindLong(_argIndex, clientId)
_argIndex = 2
_stmt.bindLong(_argIndex, clientId)
_stmt.step()
} finally {
_stmt.close()
}
}
}
public override fun updateFavoriteStatus(clientId: Long, isFavorite: Boolean) {
val _sql: String = "UPDATE client_table SET isFavorite = ? WHERE id = ?"
return performBlocking(__db, false, true) { _connection ->
val _stmt: SQLiteStatement = _connection.prepare(_sql)
try {
var _argIndex: Int = 1
val _tmp: Int = if (isFavorite) 1 else 0
_stmt.bindLong(_argIndex, _tmp.toLong())
_argIndex = 2
_stmt.bindLong(_argIndex, clientId)
_stmt.step()
} finally {
_stmt.close()
}
}
}
public companion object {
public fun getRequiredConverters(): List<KClass<*>> = emptyList()
}
}