Reputation: 3730
I'm using this library to save , retreive and delete data , but whenever i try to perform any of those operations , it throws the above mentionned error , and this is the library that i'm using
implementation 'com.github.p32929:AndroidEasySQL-Library:1.4.1'
private fun deleteCartDetails() {
val easyDB = EasyDB.init(this,"ITEMS_DB")
.setTableName("CART_TABLE")
.addColumn(Column("item_id", *arrayOf("text","unique")))
.addColumn(Column("item_productId", *arrayOf("text","not null")))
.addColumn(Column("item_title", *arrayOf("text","not null")))
.addColumn(Column("item_price", *arrayOf("text","not null")))
.addColumn(Column("item_cost", *arrayOf("text","not null")))
.addColumn(Column("item_quantity", *arrayOf("text","not null")))
easyDB.deleteAllDataFromTable()
}
any help would be appreciated guys , thank you .
Upvotes: 1
Views: 2066
Reputation: 56943
I believe that you are missing the line that creates the table before you are trying to delete rows from the table.
That is the .doneTableColumn()
which should follow the .addColumn
's
So try :-
private fun deleteCartDetails() {
val easyDB = EasyDB.init(this,"ITEMS_DB")
.setTableName("CART_TABLE")
.addColumn(Column("item_id", *arrayOf("text","unique")))
.addColumn(Column("item_productId", *arrayOf("text","not null")))
.addColumn(Column("item_title", *arrayOf("text","not null")))
.addColumn(Column("item_price", *arrayOf("text","not null")))
.addColumn(Column("item_cost", *arrayOf("text","not null")))
.addColumn(Column("item_quantity", *arrayOf("text","not null")))
.doneTableColumn() //<<<<<<<<<< ADDED
easyDB.deleteAllDataFromTable()
}
Upvotes: 1