3

I've tried several different commands for clearing my Web SQL Database and none of them work. Just to show you I've assembled all of them into one overkill function. What am I missing?

/** Drop Table from Database - Fix This **/ function overKill(tablename){ var query = "DELETE FROM " + tablename; db.transaction(function (tx) { tx.executeSql(query); }); var query = "DELETE * FROM " + tablename; db.transaction(function (tx) { tx.executeSql(query); }); var query = "DROP TABLE " + tablename; db.transaction(function (tx) { tx.executeSql(query); }); } 

5 Answers 5

4

This worked for me

tx.executeSql("DROP TABLE foo",[], function(tx,results){console.log("Successfully Dropped")}, function(tx,error){console.log("Could not delete")} ); 
Sign up to request clarification or add additional context in comments.

Comments

1

Worked for me:

tx.executeSql('DELETE FROM FormRecords');

Moreover, you cannot delete a Web SQL database.

Comments

0
DELETE * FROM... 

does not make sense. use DELETE FROM instead

Comments

0

You last variant is correct. Just for testing you can open your web resourse by Chrome. Then open Resourses -> Web SQL where you can type DROP TABLE TABLENAME and check if everething is right.

Comments

0

The follow code should works well:

var db = openDatabase(databaseName, "0.1", description, size) var db.transaction(function (t) { t.executeSql("DROP TABLE objectTable",[], function(t,results){ console.error("Table Dropped") }, function(t,error){ console.error("Error: " + error.message) } ) }) 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.