Coverage Summary for Class: SalesRoomDao_Impl (com.imecatro.demosales.data.sales.datasource)
| Class |
Method, %
|
Branch, %
|
Line, %
|
Instruction, %
|
| SalesRoomDao_Impl |
0%
(0/17)
|
0%
(0/64)
|
0%
(0/212)
|
0%
(0/875)
|
| SalesRoomDao_Impl$1 |
0%
(0/3)
|
0%
(0/10)
|
0%
(0/32)
|
0%
(0/113)
|
| SalesRoomDao_Impl$2 |
0%
(0/3)
|
0%
(0/10)
|
0%
(0/33)
|
0%
(0/118)
|
| SalesRoomDao_Impl$Companion |
0%
(0/1)
|
|
0%
(0/1)
|
0%
(0/1)
|
| Total |
0%
(0/24)
|
0%
(0/84)
|
0%
(0/278)
|
0%
(0/1107)
|
package com.imecatro.demosales.`data`.sales.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.room.util.performSuspending
import androidx.sqlite.SQLiteStatement
import com.imecatro.demosales.`data`.sales.model.SaleClientSnapshot
import com.imecatro.demosales.`data`.sales.model.SaleDataRoomModel
import com.imecatro.demosales.`data`.sales.model.SaleTotals
import javax.`annotation`.processing.Generated
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 SalesRoomDao_Impl(
__db: RoomDatabase,
) : SalesRoomDao {
private val __db: RoomDatabase
private val __insertAdapterOfSaleDataRoomModel: EntityInsertAdapter<SaleDataRoomModel>
private val __updateAdapterOfSaleDataRoomModel: EntityDeleteOrUpdateAdapter<SaleDataRoomModel>
init {
this.__db = __db
this.__insertAdapterOfSaleDataRoomModel = object : EntityInsertAdapter<SaleDataRoomModel>() {
protected override fun createQuery(): String = "INSERT OR IGNORE INTO `sales_table` (`id`,`clientId`,`creationDateMillis`,`status`,`note`,`totals_subtotal`,`totals_discount`,`totals_extra`,`totals_total`,`client_name_at_sale`,`client_address_at_sale`) VALUES (nullif(?, 0),?,?,?,?,?,?,?,?,?,?)"
protected override fun bind(statement: SQLiteStatement, entity: SaleDataRoomModel) {
statement.bindLong(1, entity.id)
val _tmpClientId: Long? = entity.clientId
if (_tmpClientId == null) {
statement.bindNull(2)
} else {
statement.bindLong(2, _tmpClientId)
}
statement.bindLong(3, entity.creationDateMillis)
statement.bindText(4, entity.status)
statement.bindText(5, entity.note)
val _tmpTotals: SaleTotals? = entity.totals
if (_tmpTotals != null) {
statement.bindDouble(6, _tmpTotals.subtotal)
statement.bindDouble(7, _tmpTotals.discount)
statement.bindDouble(8, _tmpTotals.extra)
statement.bindDouble(9, _tmpTotals.total)
} else {
statement.bindNull(6)
statement.bindNull(7)
statement.bindNull(8)
statement.bindNull(9)
}
val _tmpClientSnapshot: SaleClientSnapshot? = entity.clientSnapshot
if (_tmpClientSnapshot != null) {
val _tmpName: String? = _tmpClientSnapshot.name
if (_tmpName == null) {
statement.bindNull(10)
} else {
statement.bindText(10, _tmpName)
}
val _tmpAddress: String? = _tmpClientSnapshot.address
if (_tmpAddress == null) {
statement.bindNull(11)
} else {
statement.bindText(11, _tmpAddress)
}
} else {
statement.bindNull(10)
statement.bindNull(11)
}
}
}
this.__updateAdapterOfSaleDataRoomModel = object : EntityDeleteOrUpdateAdapter<SaleDataRoomModel>() {
protected override fun createQuery(): String = "UPDATE OR ABORT `sales_table` SET `id` = ?,`clientId` = ?,`creationDateMillis` = ?,`status` = ?,`note` = ?,`totals_subtotal` = ?,`totals_discount` = ?,`totals_extra` = ?,`totals_total` = ?,`client_name_at_sale` = ?,`client_address_at_sale` = ? WHERE `id` = ?"
protected override fun bind(statement: SQLiteStatement, entity: SaleDataRoomModel) {
statement.bindLong(1, entity.id)
val _tmpClientId: Long? = entity.clientId
if (_tmpClientId == null) {
statement.bindNull(2)
} else {
statement.bindLong(2, _tmpClientId)
}
statement.bindLong(3, entity.creationDateMillis)
statement.bindText(4, entity.status)
statement.bindText(5, entity.note)
val _tmpTotals: SaleTotals? = entity.totals
if (_tmpTotals != null) {
statement.bindDouble(6, _tmpTotals.subtotal)
statement.bindDouble(7, _tmpTotals.discount)
statement.bindDouble(8, _tmpTotals.extra)
statement.bindDouble(9, _tmpTotals.total)
} else {
statement.bindNull(6)
statement.bindNull(7)
statement.bindNull(8)
statement.bindNull(9)
}
val _tmpClientSnapshot: SaleClientSnapshot? = entity.clientSnapshot
if (_tmpClientSnapshot != null) {
val _tmpName: String? = _tmpClientSnapshot.name
if (_tmpName == null) {
statement.bindNull(10)
} else {
statement.bindText(10, _tmpName)
}
val _tmpAddress: String? = _tmpClientSnapshot.address
if (_tmpAddress == null) {
statement.bindNull(11)
} else {
statement.bindText(11, _tmpAddress)
}
} else {
statement.bindNull(10)
statement.bindNull(11)
}
statement.bindLong(12, entity.id)
}
}
}
public override fun insertSaleOnLocalDatabase(sale: SaleDataRoomModel): Long = performBlocking(__db, false, true) { _connection ->
val _result: Long = __insertAdapterOfSaleDataRoomModel.insertAndReturnId(_connection, sale)
_result
}
public override suspend fun saveSaleState(sale: SaleDataRoomModel): Unit = performSuspending(__db, false, true) { _connection ->
__updateAdapterOfSaleDataRoomModel.handle(_connection, sale)
}
public override fun getAllSales(): Flow<List<SaleDataRoomModel>> {
val _sql: String = "SELECT * FROM sales_table ORDER BY id DESC"
return createFlow(__db, false, arrayOf("sales_table")) { _connection ->
val _stmt: SQLiteStatement = _connection.prepare(_sql)
try {
val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
val _columnIndexOfClientId: Int = getColumnIndexOrThrow(_stmt, "clientId")
val _columnIndexOfCreationDateMillis: Int = getColumnIndexOrThrow(_stmt, "creationDateMillis")
val _columnIndexOfStatus: Int = getColumnIndexOrThrow(_stmt, "status")
val _columnIndexOfNote: Int = getColumnIndexOrThrow(_stmt, "note")
val _columnIndexOfSubtotal: Int = getColumnIndexOrThrow(_stmt, "totals_subtotal")
val _columnIndexOfDiscount: Int = getColumnIndexOrThrow(_stmt, "totals_discount")
val _columnIndexOfExtra: Int = getColumnIndexOrThrow(_stmt, "totals_extra")
val _columnIndexOfTotal: Int = getColumnIndexOrThrow(_stmt, "totals_total")
val _columnIndexOfName: Int = getColumnIndexOrThrow(_stmt, "client_name_at_sale")
val _columnIndexOfAddress: Int = getColumnIndexOrThrow(_stmt, "client_address_at_sale")
val _result: MutableList<SaleDataRoomModel> = mutableListOf()
while (_stmt.step()) {
val _item: SaleDataRoomModel
val _tmpId: Long
_tmpId = _stmt.getLong(_columnIndexOfId)
val _tmpClientId: Long?
if (_stmt.isNull(_columnIndexOfClientId)) {
_tmpClientId = null
} else {
_tmpClientId = _stmt.getLong(_columnIndexOfClientId)
}
val _tmpCreationDateMillis: Long
_tmpCreationDateMillis = _stmt.getLong(_columnIndexOfCreationDateMillis)
val _tmpStatus: String
_tmpStatus = _stmt.getText(_columnIndexOfStatus)
val _tmpNote: String
_tmpNote = _stmt.getText(_columnIndexOfNote)
val _tmpTotals: SaleTotals?
if (!(_stmt.isNull(_columnIndexOfSubtotal) && _stmt.isNull(_columnIndexOfDiscount) && _stmt.isNull(_columnIndexOfExtra) && _stmt.isNull(_columnIndexOfTotal))) {
val _tmpSubtotal: Double
_tmpSubtotal = _stmt.getDouble(_columnIndexOfSubtotal)
val _tmpDiscount: Double
_tmpDiscount = _stmt.getDouble(_columnIndexOfDiscount)
val _tmpExtra: Double
_tmpExtra = _stmt.getDouble(_columnIndexOfExtra)
val _tmpTotal: Double
_tmpTotal = _stmt.getDouble(_columnIndexOfTotal)
_tmpTotals = SaleTotals(_tmpSubtotal,_tmpDiscount,_tmpExtra,_tmpTotal)
} else {
_tmpTotals = null
}
val _tmpClientSnapshot: SaleClientSnapshot?
if (!(_stmt.isNull(_columnIndexOfName) && _stmt.isNull(_columnIndexOfAddress))) {
val _tmpName: String?
if (_stmt.isNull(_columnIndexOfName)) {
_tmpName = null
} else {
_tmpName = _stmt.getText(_columnIndexOfName)
}
val _tmpAddress: String?
if (_stmt.isNull(_columnIndexOfAddress)) {
_tmpAddress = null
} else {
_tmpAddress = _stmt.getText(_columnIndexOfAddress)
}
_tmpClientSnapshot = SaleClientSnapshot(_tmpName,_tmpAddress)
} else {
_tmpClientSnapshot = null
}
_item = SaleDataRoomModel(_tmpId,_tmpClientId,_tmpCreationDateMillis,_tmpStatus,_tmpNote,_tmpTotals,_tmpClientSnapshot)
_result.add(_item)
}
_result
} finally {
_stmt.close()
}
}
}
public override fun getFlowSaleById(id: Long): Flow<SaleDataRoomModel> {
val _sql: String = "SELECT * FROM sales_table WHERE id = ?"
return createFlow(__db, false, arrayOf("sales_table")) { _connection ->
val _stmt: SQLiteStatement = _connection.prepare(_sql)
try {
var _argIndex: Int = 1
_stmt.bindLong(_argIndex, id)
val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
val _columnIndexOfClientId: Int = getColumnIndexOrThrow(_stmt, "clientId")
val _columnIndexOfCreationDateMillis: Int = getColumnIndexOrThrow(_stmt, "creationDateMillis")
val _columnIndexOfStatus: Int = getColumnIndexOrThrow(_stmt, "status")
val _columnIndexOfNote: Int = getColumnIndexOrThrow(_stmt, "note")
val _columnIndexOfSubtotal: Int = getColumnIndexOrThrow(_stmt, "totals_subtotal")
val _columnIndexOfDiscount: Int = getColumnIndexOrThrow(_stmt, "totals_discount")
val _columnIndexOfExtra: Int = getColumnIndexOrThrow(_stmt, "totals_extra")
val _columnIndexOfTotal: Int = getColumnIndexOrThrow(_stmt, "totals_total")
val _columnIndexOfName: Int = getColumnIndexOrThrow(_stmt, "client_name_at_sale")
val _columnIndexOfAddress: Int = getColumnIndexOrThrow(_stmt, "client_address_at_sale")
val _result: SaleDataRoomModel
if (_stmt.step()) {
val _tmpId: Long
_tmpId = _stmt.getLong(_columnIndexOfId)
val _tmpClientId: Long?
if (_stmt.isNull(_columnIndexOfClientId)) {
_tmpClientId = null
} else {
_tmpClientId = _stmt.getLong(_columnIndexOfClientId)
}
val _tmpCreationDateMillis: Long
_tmpCreationDateMillis = _stmt.getLong(_columnIndexOfCreationDateMillis)
val _tmpStatus: String
_tmpStatus = _stmt.getText(_columnIndexOfStatus)
val _tmpNote: String
_tmpNote = _stmt.getText(_columnIndexOfNote)
val _tmpTotals: SaleTotals?
if (!(_stmt.isNull(_columnIndexOfSubtotal) && _stmt.isNull(_columnIndexOfDiscount) && _stmt.isNull(_columnIndexOfExtra) && _stmt.isNull(_columnIndexOfTotal))) {
val _tmpSubtotal: Double
_tmpSubtotal = _stmt.getDouble(_columnIndexOfSubtotal)
val _tmpDiscount: Double
_tmpDiscount = _stmt.getDouble(_columnIndexOfDiscount)
val _tmpExtra: Double
_tmpExtra = _stmt.getDouble(_columnIndexOfExtra)
val _tmpTotal: Double
_tmpTotal = _stmt.getDouble(_columnIndexOfTotal)
_tmpTotals = SaleTotals(_tmpSubtotal,_tmpDiscount,_tmpExtra,_tmpTotal)
} else {
_tmpTotals = null
}
val _tmpClientSnapshot: SaleClientSnapshot?
if (!(_stmt.isNull(_columnIndexOfName) && _stmt.isNull(_columnIndexOfAddress))) {
val _tmpName: String?
if (_stmt.isNull(_columnIndexOfName)) {
_tmpName = null
} else {
_tmpName = _stmt.getText(_columnIndexOfName)
}
val _tmpAddress: String?
if (_stmt.isNull(_columnIndexOfAddress)) {
_tmpAddress = null
} else {
_tmpAddress = _stmt.getText(_columnIndexOfAddress)
}
_tmpClientSnapshot = SaleClientSnapshot(_tmpName,_tmpAddress)
} else {
_tmpClientSnapshot = null
}
_result = SaleDataRoomModel(_tmpId,_tmpClientId,_tmpCreationDateMillis,_tmpStatus,_tmpNote,_tmpTotals,_tmpClientSnapshot)
} else {
error("The query result was empty, but expected a single row to return a NON-NULL object of type 'com.imecatro.demosales.`data`.sales.model.SaleDataRoomModel'.")
}
_result
} finally {
_stmt.close()
}
}
}
public override suspend fun getSaleById(id: Long): SaleDataRoomModel {
val _sql: String = "SELECT * FROM sales_table WHERE id = ?"
return performSuspending(__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 _columnIndexOfClientId: Int = getColumnIndexOrThrow(_stmt, "clientId")
val _columnIndexOfCreationDateMillis: Int = getColumnIndexOrThrow(_stmt, "creationDateMillis")
val _columnIndexOfStatus: Int = getColumnIndexOrThrow(_stmt, "status")
val _columnIndexOfNote: Int = getColumnIndexOrThrow(_stmt, "note")
val _columnIndexOfSubtotal: Int = getColumnIndexOrThrow(_stmt, "totals_subtotal")
val _columnIndexOfDiscount: Int = getColumnIndexOrThrow(_stmt, "totals_discount")
val _columnIndexOfExtra: Int = getColumnIndexOrThrow(_stmt, "totals_extra")
val _columnIndexOfTotal: Int = getColumnIndexOrThrow(_stmt, "totals_total")
val _columnIndexOfName: Int = getColumnIndexOrThrow(_stmt, "client_name_at_sale")
val _columnIndexOfAddress: Int = getColumnIndexOrThrow(_stmt, "client_address_at_sale")
val _result: SaleDataRoomModel
if (_stmt.step()) {
val _tmpId: Long
_tmpId = _stmt.getLong(_columnIndexOfId)
val _tmpClientId: Long?
if (_stmt.isNull(_columnIndexOfClientId)) {
_tmpClientId = null
} else {
_tmpClientId = _stmt.getLong(_columnIndexOfClientId)
}
val _tmpCreationDateMillis: Long
_tmpCreationDateMillis = _stmt.getLong(_columnIndexOfCreationDateMillis)
val _tmpStatus: String
_tmpStatus = _stmt.getText(_columnIndexOfStatus)
val _tmpNote: String
_tmpNote = _stmt.getText(_columnIndexOfNote)
val _tmpTotals: SaleTotals?
if (!(_stmt.isNull(_columnIndexOfSubtotal) && _stmt.isNull(_columnIndexOfDiscount) && _stmt.isNull(_columnIndexOfExtra) && _stmt.isNull(_columnIndexOfTotal))) {
val _tmpSubtotal: Double
_tmpSubtotal = _stmt.getDouble(_columnIndexOfSubtotal)
val _tmpDiscount: Double
_tmpDiscount = _stmt.getDouble(_columnIndexOfDiscount)
val _tmpExtra: Double
_tmpExtra = _stmt.getDouble(_columnIndexOfExtra)
val _tmpTotal: Double
_tmpTotal = _stmt.getDouble(_columnIndexOfTotal)
_tmpTotals = SaleTotals(_tmpSubtotal,_tmpDiscount,_tmpExtra,_tmpTotal)
} else {
_tmpTotals = null
}
val _tmpClientSnapshot: SaleClientSnapshot?
if (!(_stmt.isNull(_columnIndexOfName) && _stmt.isNull(_columnIndexOfAddress))) {
val _tmpName: String?
if (_stmt.isNull(_columnIndexOfName)) {
_tmpName = null
} else {
_tmpName = _stmt.getText(_columnIndexOfName)
}
val _tmpAddress: String?
if (_stmt.isNull(_columnIndexOfAddress)) {
_tmpAddress = null
} else {
_tmpAddress = _stmt.getText(_columnIndexOfAddress)
}
_tmpClientSnapshot = SaleClientSnapshot(_tmpName,_tmpAddress)
} else {
_tmpClientSnapshot = null
}
_result = SaleDataRoomModel(_tmpId,_tmpClientId,_tmpCreationDateMillis,_tmpStatus,_tmpNote,_tmpTotals,_tmpClientSnapshot)
} else {
error("The query result was empty, but expected a single row to return a NON-NULL object of type 'com.imecatro.demosales.`data`.sales.model.SaleDataRoomModel'.")
}
_result
} finally {
_stmt.close()
}
}
}
public override suspend fun deleteSaleWithId(id: Long) {
val _sql: String = "DELETE FROM sales_table WHERE id = ?"
return performSuspending(__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 suspend fun updateSaleStatus(id: Long, status: String) {
val _sql: String = "UPDATE sales_table SET status = ? WHERE id = ?"
return performSuspending(__db, false, true) { _connection ->
val _stmt: SQLiteStatement = _connection.prepare(_sql)
try {
var _argIndex: Int = 1
_stmt.bindText(_argIndex, status)
_argIndex = 2
_stmt.bindLong(_argIndex, id)
_stmt.step()
} finally {
_stmt.close()
}
}
}
public override fun updateClientOnSale(
name: String?,
address: String?,
saleId: Long,
) {
val _sql: String = "UPDATE sales_table SET client_name_at_sale = ?, client_address_at_sale = ? WHERE id = ?"
return performBlocking(__db, false, true) { _connection ->
val _stmt: SQLiteStatement = _connection.prepare(_sql)
try {
var _argIndex: Int = 1
if (name == null) {
_stmt.bindNull(_argIndex)
} else {
_stmt.bindText(_argIndex, name)
}
_argIndex = 2
if (address == null) {
_stmt.bindNull(_argIndex)
} else {
_stmt.bindText(_argIndex, address)
}
_argIndex = 3
_stmt.bindLong(_argIndex, saleId)
_stmt.step()
} finally {
_stmt.close()
}
}
}
public companion object {
public fun getRequiredConverters(): List<KClass<*>> = emptyList()
}
}