1

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'
  • This is my code
 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 .

1 Answer 1

1

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()
}
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much , i was missing that line , your help is appreciated

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.