javascript/WebSQL: how to cancel query

javascript, sql, web-sql

Solution

No abort in WebSQL API. Suggested method invoke invalid SQL to the active transaction that you want to abort and rollback, as follow is:

var errback = {
  return true; // rollback
}
tx.executeSql('ABORT', [], null, errback); // yes, this will cause error

Problem

I have this situation in which I execute a complex query which will take some time. But sometimes I don't need the result anymore, so I would like to cancel it. Is this possible? Here is the basic structure: ``` db.transaction( function(tx) { tx.executeSql('SELECT * FROM ...JOIN ...', [a,b,c], callback) ; } , function(err) { .... } , function() { /* transaction completed */ } ) ; ```

Original source