Coverage Summary for Class: ProductsDao_Impl (com.imecatro.products.data.datasource)

Class Method, % Branch, % Line, % Instruction, %
ProductsDao_Impl 0% (0/34) 0% (0/86) 0% (0/476) 0% (0/1850)
ProductsDao_Impl$1 0% (0/3) 0% (0/4) 0% (0/18) 0% (0/70)
ProductsDao_Impl$2 0% (0/3) 0% (0/8) 0% (0/34)
ProductsDao_Impl$3 0% (0/3) 0% (0/4) 0% (0/19) 0% (0/75)
ProductsDao_Impl$addStockAndUpdateProduct$2 0% (0/1) 0% (0/1) 0% (0/11)
ProductsDao_Impl$Companion 0% (0/1) 0% (0/1) 0% (0/1)
Total 0% (0/45) 0% (0/94) 0% (0/523) 0% (0/2041)


 package com.imecatro.products.`data`.datasource
 
 import androidx.collection.LongSparseArray
 import androidx.room.EntityDeleteOrUpdateAdapter
 import androidx.room.EntityInsertAdapter
 import androidx.room.RoomDatabase
 import androidx.room.coroutines.createFlow
 import androidx.room.util.appendPlaceholders
 import androidx.room.util.getColumnIndex
 import androidx.room.util.getColumnIndexOrThrow
 import androidx.room.util.performBlocking
 import androidx.room.util.performInTransactionSuspending
 import androidx.room.util.performSuspending
 import androidx.room.util.recursiveFetchLongSparseArray
 import androidx.sqlite.SQLiteConnection
 import androidx.sqlite.SQLiteStatement
 import com.imecatro.products.`data`.model.CategoryRoomEntity
 import com.imecatro.products.`data`.model.ProductAnCategoryDetailsRoomModel
 import com.imecatro.products.`data`.model.ProductFullDetailsRoomModel
 import com.imecatro.products.`data`.model.ProductRoomEntity
 import com.imecatro.products.`data`.model.StockRoomEntity
 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 kotlin.text.StringBuilder
 import kotlinx.coroutines.flow.Flow
 
 @Generated(value = ["androidx.room.RoomProcessor"])
 @Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION", "REMOVAL"])
 public class ProductsDao_Impl(
   __db: RoomDatabase,
 ) : ProductsDao {
   private val __db: RoomDatabase
 
   private val __insertAdapterOfProductRoomEntity: EntityInsertAdapter<ProductRoomEntity>
 
   private val __insertAdapterOfStockRoomEntity: EntityInsertAdapter<StockRoomEntity>
 
   private val __updateAdapterOfProductRoomEntity: EntityDeleteOrUpdateAdapter<ProductRoomEntity>
   init {
     this.__db = __db
     this.__insertAdapterOfProductRoomEntity = object : EntityInsertAdapter<ProductRoomEntity>() {
       protected override fun createQuery(): String = "INSERT OR REPLACE INTO `products_table` (`id`,`name`,`price`,`currency`,`unit`,`stock`,`details`,`imageUri`,`category_id`,`barcode`) VALUES (nullif(?, 0),?,?,?,?,?,?,?,?,?)"
 
       protected override fun bind(statement: SQLiteStatement, entity: ProductRoomEntity) {
         statement.bindLong(1, entity.id)
         statement.bindText(2, entity.name)
         statement.bindDouble(3, entity.price)
         statement.bindText(4, entity.currency)
         statement.bindText(5, entity.unit)
         statement.bindDouble(6, entity.stock)
         statement.bindText(7, entity.details)
         statement.bindText(8, entity.imageUri)
         val _tmpCategoryId: Long? = entity.categoryId
         if (_tmpCategoryId == null) {
           statement.bindNull(9)
         } else {
           statement.bindLong(9, _tmpCategoryId)
         }
         val _tmpBarcode: String? = entity.barcode
         if (_tmpBarcode == null) {
           statement.bindNull(10)
         } else {
           statement.bindText(10, _tmpBarcode)
         }
       }
     }
     this.__insertAdapterOfStockRoomEntity = object : EntityInsertAdapter<StockRoomEntity>() {
       protected override fun createQuery(): String = "INSERT OR REPLACE INTO `stock_table` (`id`,`product_id`,`description`,`amount`,`date`,`timeStamp`) VALUES (nullif(?, 0),?,?,?,?,?)"
 
       protected override fun bind(statement: SQLiteStatement, entity: StockRoomEntity) {
         statement.bindLong(1, entity.id.toLong())
         statement.bindLong(2, entity.productId)
         statement.bindText(3, entity.description)
         statement.bindDouble(4, entity.amount)
         statement.bindText(5, entity.date)
         statement.bindText(6, entity.timeStamp)
       }
     }
     this.__updateAdapterOfProductRoomEntity = object : EntityDeleteOrUpdateAdapter<ProductRoomEntity>() {
       protected override fun createQuery(): String = "UPDATE OR ABORT `products_table` SET `id` = ?,`name` = ?,`price` = ?,`currency` = ?,`unit` = ?,`stock` = ?,`details` = ?,`imageUri` = ?,`category_id` = ?,`barcode` = ? WHERE `id` = ?"
 
       protected override fun bind(statement: SQLiteStatement, entity: ProductRoomEntity) {
         statement.bindLong(1, entity.id)
         statement.bindText(2, entity.name)
         statement.bindDouble(3, entity.price)
         statement.bindText(4, entity.currency)
         statement.bindText(5, entity.unit)
         statement.bindDouble(6, entity.stock)
         statement.bindText(7, entity.details)
         statement.bindText(8, entity.imageUri)
         val _tmpCategoryId: Long? = entity.categoryId
         if (_tmpCategoryId == null) {
           statement.bindNull(9)
         } else {
           statement.bindLong(9, _tmpCategoryId)
         }
         val _tmpBarcode: String? = entity.barcode
         if (_tmpBarcode == null) {
           statement.bindNull(10)
         } else {
           statement.bindText(10, _tmpBarcode)
         }
         statement.bindLong(11, entity.id)
       }
     }
   }
 
   public override fun addProduct(product: ProductRoomEntity): Long = performBlocking(__db, false, true) { _connection ->
     val _result: Long = __insertAdapterOfProductRoomEntity.insertAndReturnId(_connection, product)
     _result
   }
 
   public override fun addStock(stock: StockRoomEntity): Unit = performBlocking(__db, false, true) { _connection ->
     __insertAdapterOfStockRoomEntity.insert(_connection, stock)
   }
 
   public override fun updateProduct(product: ProductRoomEntity): Unit = performBlocking(__db, false, true) { _connection ->
     __updateAdapterOfProductRoomEntity.handle(_connection, product)
   }
 
   public override suspend fun addStockAndUpdateProduct(stock: StockRoomEntity): Unit = performInTransactionSuspending(__db) {
     super@ProductsDao_Impl.addStockAndUpdateProduct(stock)
   }
 
   public override fun getAllProducts(): Flow<List<ProductRoomEntity>> {
     val _sql: String = "SELECT * FROM products_table ORDER BY id"
     return createFlow(__db, false, arrayOf("products_table")) { _connection ->
       val _stmt: SQLiteStatement = _connection.prepare(_sql)
       try {
         val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
         val _columnIndexOfName: Int = getColumnIndexOrThrow(_stmt, "name")
         val _columnIndexOfPrice: Int = getColumnIndexOrThrow(_stmt, "price")
         val _columnIndexOfCurrency: Int = getColumnIndexOrThrow(_stmt, "currency")
         val _columnIndexOfUnit: Int = getColumnIndexOrThrow(_stmt, "unit")
         val _columnIndexOfStock: Int = getColumnIndexOrThrow(_stmt, "stock")
         val _columnIndexOfDetails: Int = getColumnIndexOrThrow(_stmt, "details")
         val _columnIndexOfImageUri: Int = getColumnIndexOrThrow(_stmt, "imageUri")
         val _columnIndexOfCategoryId: Int = getColumnIndexOrThrow(_stmt, "category_id")
         val _columnIndexOfBarcode: Int = getColumnIndexOrThrow(_stmt, "barcode")
         val _result: MutableList<ProductRoomEntity> = mutableListOf()
         while (_stmt.step()) {
           val _item: ProductRoomEntity
           val _tmpId: Long
           _tmpId = _stmt.getLong(_columnIndexOfId)
           val _tmpName: String
           _tmpName = _stmt.getText(_columnIndexOfName)
           val _tmpPrice: Double
           _tmpPrice = _stmt.getDouble(_columnIndexOfPrice)
           val _tmpCurrency: String
           _tmpCurrency = _stmt.getText(_columnIndexOfCurrency)
           val _tmpUnit: String
           _tmpUnit = _stmt.getText(_columnIndexOfUnit)
           val _tmpStock: Double
           _tmpStock = _stmt.getDouble(_columnIndexOfStock)
           val _tmpDetails: String
           _tmpDetails = _stmt.getText(_columnIndexOfDetails)
           val _tmpImageUri: String
           _tmpImageUri = _stmt.getText(_columnIndexOfImageUri)
           val _tmpCategoryId: Long?
           if (_stmt.isNull(_columnIndexOfCategoryId)) {
             _tmpCategoryId = null
           } else {
             _tmpCategoryId = _stmt.getLong(_columnIndexOfCategoryId)
           }
           val _tmpBarcode: String?
           if (_stmt.isNull(_columnIndexOfBarcode)) {
             _tmpBarcode = null
           } else {
             _tmpBarcode = _stmt.getText(_columnIndexOfBarcode)
           }
           _item = ProductRoomEntity(_tmpId,_tmpName,_tmpPrice,_tmpCurrency,_tmpUnit,_tmpStock,_tmpDetails,_tmpImageUri,_tmpCategoryId,_tmpBarcode)
           _result.add(_item)
         }
         _result
       } finally {
         _stmt.close()
       }
     }
   }
 
   public override fun getProductsWithCategories(): Flow<List<ProductAnCategoryDetailsRoomModel>> {
     val _sql: String = "SELECT * FROM products_table ORDER BY name"
     return createFlow(__db, true, arrayOf("categories_table", "products_table")) { _connection ->
       val _stmt: SQLiteStatement = _connection.prepare(_sql)
       try {
         val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
         val _columnIndexOfName: Int = getColumnIndexOrThrow(_stmt, "name")
         val _columnIndexOfPrice: Int = getColumnIndexOrThrow(_stmt, "price")
         val _columnIndexOfCurrency: Int = getColumnIndexOrThrow(_stmt, "currency")
         val _columnIndexOfUnit: Int = getColumnIndexOrThrow(_stmt, "unit")
         val _columnIndexOfStock: Int = getColumnIndexOrThrow(_stmt, "stock")
         val _columnIndexOfDetails: Int = getColumnIndexOrThrow(_stmt, "details")
         val _columnIndexOfImageUri: Int = getColumnIndexOrThrow(_stmt, "imageUri")
         val _columnIndexOfCategoryId: Int = getColumnIndexOrThrow(_stmt, "category_id")
         val _columnIndexOfBarcode: Int = getColumnIndexOrThrow(_stmt, "barcode")
         val _collectionCategory: LongSparseArray<CategoryRoomEntity?> = LongSparseArray<CategoryRoomEntity?>()
         while (_stmt.step()) {
           val _tmpKey: Long?
           if (_stmt.isNull(_columnIndexOfCategoryId)) {
             _tmpKey = null
           } else {
             _tmpKey = _stmt.getLong(_columnIndexOfCategoryId)
           }
           if (_tmpKey != null) {
             _collectionCategory.put(_tmpKey, null)
           }
         }
         _stmt.reset()
         __fetchRelationshipcategoriesTableAscomImecatroProductsDataModelCategoryRoomEntity(_connection, _collectionCategory)
         val _result: MutableList<ProductAnCategoryDetailsRoomModel> = mutableListOf()
         while (_stmt.step()) {
           val _item: ProductAnCategoryDetailsRoomModel
           val _tmpProduct: ProductRoomEntity
           val _tmpId: Long
           _tmpId = _stmt.getLong(_columnIndexOfId)
           val _tmpName: String
           _tmpName = _stmt.getText(_columnIndexOfName)
           val _tmpPrice: Double
           _tmpPrice = _stmt.getDouble(_columnIndexOfPrice)
           val _tmpCurrency: String
           _tmpCurrency = _stmt.getText(_columnIndexOfCurrency)
           val _tmpUnit: String
           _tmpUnit = _stmt.getText(_columnIndexOfUnit)
           val _tmpStock: Double
           _tmpStock = _stmt.getDouble(_columnIndexOfStock)
           val _tmpDetails: String
           _tmpDetails = _stmt.getText(_columnIndexOfDetails)
           val _tmpImageUri: String
           _tmpImageUri = _stmt.getText(_columnIndexOfImageUri)
           val _tmpCategoryId: Long?
           if (_stmt.isNull(_columnIndexOfCategoryId)) {
             _tmpCategoryId = null
           } else {
             _tmpCategoryId = _stmt.getLong(_columnIndexOfCategoryId)
           }
           val _tmpBarcode: String?
           if (_stmt.isNull(_columnIndexOfBarcode)) {
             _tmpBarcode = null
           } else {
             _tmpBarcode = _stmt.getText(_columnIndexOfBarcode)
           }
           _tmpProduct = ProductRoomEntity(_tmpId,_tmpName,_tmpPrice,_tmpCurrency,_tmpUnit,_tmpStock,_tmpDetails,_tmpImageUri,_tmpCategoryId,_tmpBarcode)
           val _tmpCategory: CategoryRoomEntity?
           val _tmpKey_1: Long?
           if (_stmt.isNull(_columnIndexOfCategoryId)) {
             _tmpKey_1 = null
           } else {
             _tmpKey_1 = _stmt.getLong(_columnIndexOfCategoryId)
           }
           if (_tmpKey_1 != null) {
             _tmpCategory = _collectionCategory.get(_tmpKey_1)
           } else {
             _tmpCategory = null
           }
           _item = ProductAnCategoryDetailsRoomModel(_tmpProduct,_tmpCategory)
           _result.add(_item)
         }
         _result
       } finally {
         _stmt.close()
       }
     }
   }
 
   public override fun getProductFullDetailsByd(id: Long): ProductFullDetailsRoomModel {
     val _sql: String = "SELECT * FROM products_table WHERE id = ? ORDER BY name"
     return performBlocking(__db, true, true) { _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 _columnIndexOfPrice: Int = getColumnIndexOrThrow(_stmt, "price")
         val _columnIndexOfCurrency: Int = getColumnIndexOrThrow(_stmt, "currency")
         val _columnIndexOfUnit: Int = getColumnIndexOrThrow(_stmt, "unit")
         val _columnIndexOfStock: Int = getColumnIndexOrThrow(_stmt, "stock")
         val _columnIndexOfDetails: Int = getColumnIndexOrThrow(_stmt, "details")
         val _columnIndexOfImageUri: Int = getColumnIndexOrThrow(_stmt, "imageUri")
         val _columnIndexOfCategoryId: Int = getColumnIndexOrThrow(_stmt, "category_id")
         val _columnIndexOfBarcode: Int = getColumnIndexOrThrow(_stmt, "barcode")
         val _collectionCategory: LongSparseArray<CategoryRoomEntity?> = LongSparseArray<CategoryRoomEntity?>()
         val _collectionStock: LongSparseArray<MutableList<StockRoomEntity>> = LongSparseArray<MutableList<StockRoomEntity>>()
         while (_stmt.step()) {
           val _tmpKey: Long?
           if (_stmt.isNull(_columnIndexOfCategoryId)) {
             _tmpKey = null
           } else {
             _tmpKey = _stmt.getLong(_columnIndexOfCategoryId)
           }
           if (_tmpKey != null) {
             _collectionCategory.put(_tmpKey, null)
           }
           val _tmpKey_1: Long
           _tmpKey_1 = _stmt.getLong(_columnIndexOfId)
           if (!_collectionStock.containsKey(_tmpKey_1)) {
             _collectionStock.put(_tmpKey_1, mutableListOf())
           }
         }
         _stmt.reset()
         __fetchRelationshipcategoriesTableAscomImecatroProductsDataModelCategoryRoomEntity(_connection, _collectionCategory)
         __fetchRelationshipstockTableAscomImecatroProductsDataModelStockRoomEntity(_connection, _collectionStock)
         val _result: ProductFullDetailsRoomModel
         if (_stmt.step()) {
           val _tmpProduct: ProductRoomEntity
           val _tmpId: Long
           _tmpId = _stmt.getLong(_columnIndexOfId)
           val _tmpName: String
           _tmpName = _stmt.getText(_columnIndexOfName)
           val _tmpPrice: Double
           _tmpPrice = _stmt.getDouble(_columnIndexOfPrice)
           val _tmpCurrency: String
           _tmpCurrency = _stmt.getText(_columnIndexOfCurrency)
           val _tmpUnit: String
           _tmpUnit = _stmt.getText(_columnIndexOfUnit)
           val _tmpStock: Double
           _tmpStock = _stmt.getDouble(_columnIndexOfStock)
           val _tmpDetails: String
           _tmpDetails = _stmt.getText(_columnIndexOfDetails)
           val _tmpImageUri: String
           _tmpImageUri = _stmt.getText(_columnIndexOfImageUri)
           val _tmpCategoryId: Long?
           if (_stmt.isNull(_columnIndexOfCategoryId)) {
             _tmpCategoryId = null
           } else {
             _tmpCategoryId = _stmt.getLong(_columnIndexOfCategoryId)
           }
           val _tmpBarcode: String?
           if (_stmt.isNull(_columnIndexOfBarcode)) {
             _tmpBarcode = null
           } else {
             _tmpBarcode = _stmt.getText(_columnIndexOfBarcode)
           }
           _tmpProduct = ProductRoomEntity(_tmpId,_tmpName,_tmpPrice,_tmpCurrency,_tmpUnit,_tmpStock,_tmpDetails,_tmpImageUri,_tmpCategoryId,_tmpBarcode)
           val _tmpCategory: CategoryRoomEntity?
           val _tmpKey_2: Long?
           if (_stmt.isNull(_columnIndexOfCategoryId)) {
             _tmpKey_2 = null
           } else {
             _tmpKey_2 = _stmt.getLong(_columnIndexOfCategoryId)
           }
           if (_tmpKey_2 != null) {
             _tmpCategory = _collectionCategory.get(_tmpKey_2)
           } else {
             _tmpCategory = null
           }
           val _tmpStockCollection: MutableList<StockRoomEntity>
           val _tmpKey_3: Long
           _tmpKey_3 = _stmt.getLong(_columnIndexOfId)
           _tmpStockCollection = checkNotNull(_collectionStock.get(_tmpKey_3))
           _result = ProductFullDetailsRoomModel(_tmpProduct,_tmpCategory,_tmpStockCollection)
         } else {
           error("The query result was empty, but expected a single row to return a NON-NULL object of type 'com.imecatro.products.`data`.model.ProductFullDetailsRoomModel'.")
         }
         _result
       } finally {
         _stmt.close()
       }
     }
   }
 
   public override fun getProductDetailsById(id: Long): ProductRoomEntity {
     val _sql: String = "SELECT * FROM products_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 _columnIndexOfPrice: Int = getColumnIndexOrThrow(_stmt, "price")
         val _columnIndexOfCurrency: Int = getColumnIndexOrThrow(_stmt, "currency")
         val _columnIndexOfUnit: Int = getColumnIndexOrThrow(_stmt, "unit")
         val _columnIndexOfStock: Int = getColumnIndexOrThrow(_stmt, "stock")
         val _columnIndexOfDetails: Int = getColumnIndexOrThrow(_stmt, "details")
         val _columnIndexOfImageUri: Int = getColumnIndexOrThrow(_stmt, "imageUri")
         val _columnIndexOfCategoryId: Int = getColumnIndexOrThrow(_stmt, "category_id")
         val _columnIndexOfBarcode: Int = getColumnIndexOrThrow(_stmt, "barcode")
         val _result: ProductRoomEntity
         if (_stmt.step()) {
           val _tmpId: Long
           _tmpId = _stmt.getLong(_columnIndexOfId)
           val _tmpName: String
           _tmpName = _stmt.getText(_columnIndexOfName)
           val _tmpPrice: Double
           _tmpPrice = _stmt.getDouble(_columnIndexOfPrice)
           val _tmpCurrency: String
           _tmpCurrency = _stmt.getText(_columnIndexOfCurrency)
           val _tmpUnit: String
           _tmpUnit = _stmt.getText(_columnIndexOfUnit)
           val _tmpStock: Double
           _tmpStock = _stmt.getDouble(_columnIndexOfStock)
           val _tmpDetails: String
           _tmpDetails = _stmt.getText(_columnIndexOfDetails)
           val _tmpImageUri: String
           _tmpImageUri = _stmt.getText(_columnIndexOfImageUri)
           val _tmpCategoryId: Long?
           if (_stmt.isNull(_columnIndexOfCategoryId)) {
             _tmpCategoryId = null
           } else {
             _tmpCategoryId = _stmt.getLong(_columnIndexOfCategoryId)
           }
           val _tmpBarcode: String?
           if (_stmt.isNull(_columnIndexOfBarcode)) {
             _tmpBarcode = null
           } else {
             _tmpBarcode = _stmt.getText(_columnIndexOfBarcode)
           }
           _result = ProductRoomEntity(_tmpId,_tmpName,_tmpPrice,_tmpCurrency,_tmpUnit,_tmpStock,_tmpDetails,_tmpImageUri,_tmpCategoryId,_tmpBarcode)
         } else {
           error("The query result was empty, but expected a single row to return a NON-NULL object of type 'com.imecatro.products.`data`.model.ProductRoomEntity'.")
         }
         _result
       } finally {
         _stmt.close()
       }
     }
   }
 
   public override fun searchProducts(productName: String): Flow<List<ProductRoomEntity>> {
     val _sql: String = """
         |
         |    SELECT * FROM products_table 
         |    WHERE (? != '' AND name LIKE ? || '%')
         |""".trimMargin()
     return createFlow(__db, false, arrayOf("products_table")) { _connection ->
       val _stmt: SQLiteStatement = _connection.prepare(_sql)
       try {
         var _argIndex: Int = 1
         _stmt.bindText(_argIndex, productName)
         _argIndex = 2
         _stmt.bindText(_argIndex, productName)
         val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
         val _columnIndexOfName: Int = getColumnIndexOrThrow(_stmt, "name")
         val _columnIndexOfPrice: Int = getColumnIndexOrThrow(_stmt, "price")
         val _columnIndexOfCurrency: Int = getColumnIndexOrThrow(_stmt, "currency")
         val _columnIndexOfUnit: Int = getColumnIndexOrThrow(_stmt, "unit")
         val _columnIndexOfStock: Int = getColumnIndexOrThrow(_stmt, "stock")
         val _columnIndexOfDetails: Int = getColumnIndexOrThrow(_stmt, "details")
         val _columnIndexOfImageUri: Int = getColumnIndexOrThrow(_stmt, "imageUri")
         val _columnIndexOfCategoryId: Int = getColumnIndexOrThrow(_stmt, "category_id")
         val _columnIndexOfBarcode: Int = getColumnIndexOrThrow(_stmt, "barcode")
         val _result: MutableList<ProductRoomEntity> = mutableListOf()
         while (_stmt.step()) {
           val _item: ProductRoomEntity
           val _tmpId: Long
           _tmpId = _stmt.getLong(_columnIndexOfId)
           val _tmpName: String
           _tmpName = _stmt.getText(_columnIndexOfName)
           val _tmpPrice: Double
           _tmpPrice = _stmt.getDouble(_columnIndexOfPrice)
           val _tmpCurrency: String
           _tmpCurrency = _stmt.getText(_columnIndexOfCurrency)
           val _tmpUnit: String
           _tmpUnit = _stmt.getText(_columnIndexOfUnit)
           val _tmpStock: Double
           _tmpStock = _stmt.getDouble(_columnIndexOfStock)
           val _tmpDetails: String
           _tmpDetails = _stmt.getText(_columnIndexOfDetails)
           val _tmpImageUri: String
           _tmpImageUri = _stmt.getText(_columnIndexOfImageUri)
           val _tmpCategoryId: Long?
           if (_stmt.isNull(_columnIndexOfCategoryId)) {
             _tmpCategoryId = null
           } else {
             _tmpCategoryId = _stmt.getLong(_columnIndexOfCategoryId)
           }
           val _tmpBarcode: String?
           if (_stmt.isNull(_columnIndexOfBarcode)) {
             _tmpBarcode = null
           } else {
             _tmpBarcode = _stmt.getText(_columnIndexOfBarcode)
           }
           _item = ProductRoomEntity(_tmpId,_tmpName,_tmpPrice,_tmpCurrency,_tmpUnit,_tmpStock,_tmpDetails,_tmpImageUri,_tmpCategoryId,_tmpBarcode)
           _result.add(_item)
         }
         _result
       } finally {
         _stmt.close()
       }
     }
   }
 
   public override suspend fun searchProductByBarcode(barcode: String): ProductRoomEntity {
     val _sql: String = "SELECT * FROM products_table WHERE (? != '' AND barcode LIKE ?)"
     return performSuspending(__db, true, false) { _connection ->
       val _stmt: SQLiteStatement = _connection.prepare(_sql)
       try {
         var _argIndex: Int = 1
         _stmt.bindText(_argIndex, barcode)
         _argIndex = 2
         _stmt.bindText(_argIndex, barcode)
         val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
         val _columnIndexOfName: Int = getColumnIndexOrThrow(_stmt, "name")
         val _columnIndexOfPrice: Int = getColumnIndexOrThrow(_stmt, "price")
         val _columnIndexOfCurrency: Int = getColumnIndexOrThrow(_stmt, "currency")
         val _columnIndexOfUnit: Int = getColumnIndexOrThrow(_stmt, "unit")
         val _columnIndexOfStock: Int = getColumnIndexOrThrow(_stmt, "stock")
         val _columnIndexOfDetails: Int = getColumnIndexOrThrow(_stmt, "details")
         val _columnIndexOfImageUri: Int = getColumnIndexOrThrow(_stmt, "imageUri")
         val _columnIndexOfCategoryId: Int = getColumnIndexOrThrow(_stmt, "category_id")
         val _columnIndexOfBarcode: Int = getColumnIndexOrThrow(_stmt, "barcode")
         val _result: ProductRoomEntity
         if (_stmt.step()) {
           val _tmpId: Long
           _tmpId = _stmt.getLong(_columnIndexOfId)
           val _tmpName: String
           _tmpName = _stmt.getText(_columnIndexOfName)
           val _tmpPrice: Double
           _tmpPrice = _stmt.getDouble(_columnIndexOfPrice)
           val _tmpCurrency: String
           _tmpCurrency = _stmt.getText(_columnIndexOfCurrency)
           val _tmpUnit: String
           _tmpUnit = _stmt.getText(_columnIndexOfUnit)
           val _tmpStock: Double
           _tmpStock = _stmt.getDouble(_columnIndexOfStock)
           val _tmpDetails: String
           _tmpDetails = _stmt.getText(_columnIndexOfDetails)
           val _tmpImageUri: String
           _tmpImageUri = _stmt.getText(_columnIndexOfImageUri)
           val _tmpCategoryId: Long?
           if (_stmt.isNull(_columnIndexOfCategoryId)) {
             _tmpCategoryId = null
           } else {
             _tmpCategoryId = _stmt.getLong(_columnIndexOfCategoryId)
           }
           val _tmpBarcode: String?
           if (_stmt.isNull(_columnIndexOfBarcode)) {
             _tmpBarcode = null
           } else {
             _tmpBarcode = _stmt.getText(_columnIndexOfBarcode)
           }
           _result = ProductRoomEntity(_tmpId,_tmpName,_tmpPrice,_tmpCurrency,_tmpUnit,_tmpStock,_tmpDetails,_tmpImageUri,_tmpCategoryId,_tmpBarcode)
         } else {
           error("The query result was empty, but expected a single row to return a NON-NULL object of type 'com.imecatro.products.`data`.model.ProductRoomEntity'.")
         }
         _result
       } finally {
         _stmt.close()
       }
     }
   }
 
   public override fun getProductStockHistory(id: Long): List<StockRoomEntity> {
     val _sql: String = "SELECT * FROM stock_table WHERE product_id = ? ORDER BY id DESC"
     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 _columnIndexOfProductId: Int = getColumnIndexOrThrow(_stmt, "product_id")
         val _columnIndexOfDescription: Int = getColumnIndexOrThrow(_stmt, "description")
         val _columnIndexOfAmount: Int = getColumnIndexOrThrow(_stmt, "amount")
         val _columnIndexOfDate: Int = getColumnIndexOrThrow(_stmt, "date")
         val _columnIndexOfTimeStamp: Int = getColumnIndexOrThrow(_stmt, "timeStamp")
         val _result: MutableList<StockRoomEntity> = mutableListOf()
         while (_stmt.step()) {
           val _item: StockRoomEntity
           val _tmpId: Int
           _tmpId = _stmt.getLong(_columnIndexOfId).toInt()
           val _tmpProductId: Long
           _tmpProductId = _stmt.getLong(_columnIndexOfProductId)
           val _tmpDescription: String
           _tmpDescription = _stmt.getText(_columnIndexOfDescription)
           val _tmpAmount: Double
           _tmpAmount = _stmt.getDouble(_columnIndexOfAmount)
           val _tmpDate: String
           _tmpDate = _stmt.getText(_columnIndexOfDate)
           val _tmpTimeStamp: String
           _tmpTimeStamp = _stmt.getText(_columnIndexOfTimeStamp)
           _item = StockRoomEntity(_tmpId,_tmpProductId,_tmpDescription,_tmpAmount,_tmpDate,_tmpTimeStamp)
           _result.add(_item)
         }
         _result
       } finally {
         _stmt.close()
       }
     }
   }
 
   public override fun deleteProductById(id: Long) {
     val _sql: String = "DELETE FROM products_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 updateProductStock(newStock: Double, id: Long) {
     val _sql: String = "UPDATE products_table SET stock = ? WHERE id = ?"
     return performBlocking(__db, false, true) { _connection ->
       val _stmt: SQLiteStatement = _connection.prepare(_sql)
       try {
         var _argIndex: Int = 1
         _stmt.bindDouble(_argIndex, newStock)
         _argIndex = 2
         _stmt.bindLong(_argIndex, id)
         _stmt.step()
       } finally {
         _stmt.close()
       }
     }
   }
 
   public override suspend fun bumpProductStock(productId: Long, delta: Double) {
     val _sql: String = "UPDATE products_table SET stock = stock + ? WHERE id = ?"
     return performSuspending(__db, false, true) { _connection ->
       val _stmt: SQLiteStatement = _connection.prepare(_sql)
       try {
         var _argIndex: Int = 1
         _stmt.bindDouble(_argIndex, delta)
         _argIndex = 2
         _stmt.bindLong(_argIndex, productId)
         _stmt.step()
       } finally {
         _stmt.close()
       }
     }
   }
 
   public override suspend fun rebuildProductStock(productId: Long) {
     val _sql: String = "UPDATE products_table SET stock = IFNULL((SELECT SUM(s.amount) FROM stock_table s WHERE s.product_id = ?), 0) WHERE id = ?"
     return performSuspending(__db, false, true) { _connection ->
       val _stmt: SQLiteStatement = _connection.prepare(_sql)
       try {
         var _argIndex: Int = 1
         _stmt.bindLong(_argIndex, productId)
         _argIndex = 2
         _stmt.bindLong(_argIndex, productId)
         _stmt.step()
       } finally {
         _stmt.close()
       }
     }
   }
 
   private fun __fetchRelationshipcategoriesTableAscomImecatroProductsDataModelCategoryRoomEntity(_connection: SQLiteConnection, _map: LongSparseArray<CategoryRoomEntity?>) {
     if (_map.isEmpty()) {
       return
     }
     if (_map.size() > 999) {
       recursiveFetchLongSparseArray(_map, false) { _tmpMap ->
         __fetchRelationshipcategoriesTableAscomImecatroProductsDataModelCategoryRoomEntity(_connection, _tmpMap)
       }
       return
     }
     val _stringBuilder: StringBuilder = StringBuilder()
     _stringBuilder.append("SELECT `id`,`name` FROM `categories_table` WHERE `id` IN (")
     val _inputSize: Int = _map.size()
     appendPlaceholders(_stringBuilder, _inputSize)
     _stringBuilder.append(")")
     val _sql: String = _stringBuilder.toString()
     val _stmt: SQLiteStatement = _connection.prepare(_sql)
     var _argIndex: Int = 1
     for (i in 0 until _map.size()) {
       val _item: Long = _map.keyAt(i)
       _stmt.bindLong(_argIndex, _item)
       _argIndex++
     }
     try {
       val _itemKeyIndex: Int = getColumnIndex(_stmt, "id")
       if (_itemKeyIndex == -1) {
         return
       }
       val _columnIndexOfId: Int = 0
       val _columnIndexOfName: Int = 1
       while (_stmt.step()) {
         val _tmpKey: Long
         _tmpKey = _stmt.getLong(_itemKeyIndex)
         if (_map.containsKey(_tmpKey)) {
           val _item_1: CategoryRoomEntity?
           val _tmpId: Long
           _tmpId = _stmt.getLong(_columnIndexOfId)
           val _tmpName: String
           _tmpName = _stmt.getText(_columnIndexOfName)
           _item_1 = CategoryRoomEntity(_tmpId,_tmpName)
           _map.put(_tmpKey, _item_1)
         }
       }
     } finally {
       _stmt.close()
     }
   }
 
   private fun __fetchRelationshipstockTableAscomImecatroProductsDataModelStockRoomEntity(_connection: SQLiteConnection, _map: LongSparseArray<MutableList<StockRoomEntity>>) {
     if (_map.isEmpty()) {
       return
     }
     if (_map.size() > 999) {
       recursiveFetchLongSparseArray(_map, true) { _tmpMap ->
         __fetchRelationshipstockTableAscomImecatroProductsDataModelStockRoomEntity(_connection, _tmpMap)
       }
       return
     }
     val _stringBuilder: StringBuilder = StringBuilder()
     _stringBuilder.append("SELECT `id`,`product_id`,`description`,`amount`,`date`,`timeStamp` FROM `stock_table` WHERE `product_id` IN (")
     val _inputSize: Int = _map.size()
     appendPlaceholders(_stringBuilder, _inputSize)
     _stringBuilder.append(")")
     val _sql: String = _stringBuilder.toString()
     val _stmt: SQLiteStatement = _connection.prepare(_sql)
     var _argIndex: Int = 1
     for (i in 0 until _map.size()) {
       val _item: Long = _map.keyAt(i)
       _stmt.bindLong(_argIndex, _item)
       _argIndex++
     }
     try {
       val _itemKeyIndex: Int = getColumnIndex(_stmt, "product_id")
       if (_itemKeyIndex == -1) {
         return
       }
       val _columnIndexOfId: Int = 0
       val _columnIndexOfProductId: Int = 1
       val _columnIndexOfDescription: Int = 2
       val _columnIndexOfAmount: Int = 3
       val _columnIndexOfDate: Int = 4
       val _columnIndexOfTimeStamp: Int = 5
       while (_stmt.step()) {
         val _tmpKey: Long
         _tmpKey = _stmt.getLong(_itemKeyIndex)
         val _tmpRelation: MutableList<StockRoomEntity>? = _map.get(_tmpKey)
         if (_tmpRelation != null) {
           val _item_1: StockRoomEntity
           val _tmpId: Int
           _tmpId = _stmt.getLong(_columnIndexOfId).toInt()
           val _tmpProductId: Long
           _tmpProductId = _stmt.getLong(_columnIndexOfProductId)
           val _tmpDescription: String
           _tmpDescription = _stmt.getText(_columnIndexOfDescription)
           val _tmpAmount: Double
           _tmpAmount = _stmt.getDouble(_columnIndexOfAmount)
           val _tmpDate: String
           _tmpDate = _stmt.getText(_columnIndexOfDate)
           val _tmpTimeStamp: String
           _tmpTimeStamp = _stmt.getText(_columnIndexOfTimeStamp)
           _item_1 = StockRoomEntity(_tmpId,_tmpProductId,_tmpDescription,_tmpAmount,_tmpDate,_tmpTimeStamp)
           _tmpRelation.add(_item_1)
         }
       }
     } finally {
       _stmt.close()
     }
   }
 
   public companion object {
     public fun getRequiredConverters(): List<KClass<*>> = emptyList()
   }
 }