Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71530

How to delete or drop a table in Ionic 2 SqlStorage WebSql

$
0
0

@johnedvard wrote:

I am trying to delete a table in my database (web database) by using a method like this:

private emptyStorage():void{
        this.platform.ready().then(() => {
           console.log("empty the storage");
           this.storage.query("DROP TABLE IF EXISTS cards"),(data)=>{
               console.log("deleted",data); // never gets printed
           },(error) =>{
               console.log("error deleted",error.err); // never gets printed
           };
        });
    }

I know the table exists because I am able to read data from it by writing 'SELECT * FROM cards' in another query. And I am also able to add items to the table. I can also add that I created the table with this query: 'CREATE TABLE IF NOT EXISTS cards (id INTEGER PRIMARY KEY AUTOINCREMENT, cardId TEXT, name TEXT)'

However, I have not been able to delete the table. Any suggestions on how to delete the entire table?

EDIT: I meant to write TABLE from the beginning, not VIEW. None of them work though :confused:

Posts: 4

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 71530

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>