storesafe / cordova-sqlite-storage

A Cordova/PhoneGap plugin to open and use sqlite databases on Android, iOS and Windows with HTML5/Web SQL API
Other
2.14k stars 713 forks source link

How to delete all records from a table #936

Open thamibn opened 3 years ago

thamibn commented 3 years ago

Hi,

I have tried to run this query


db.transaction(function(tx) {
          tx.executeSql('DELETE * FROM pages');
        }, function(error) {
          alert('Transaction ERROR: ' + error.message);
        }, function() {
          alert('Table pages truncated');
        });

basically i am trying to remove all records so i can insert new ones However i am getting error says:

a statement with no error handler failed: near "": syntax error (Sqlite code 1 SQLITE_ERROR):,while compiling : DELETE FROM pages, (OS error -2:No such file or directory)

please help with the correct syntax to remove all records from table thanks