views:

208

answers:

0

I use the html5 database in safari like that (simplified code) :

createContent : function() {
   this.database.transaction(function(transaction){
       for (var elm in lotOfElm) {
          transaction.executeSql('INSERT....VALUES (?, ...?)', [elm.att1, elm.att2...], nullDataHandler, errorHandler);
       }
   });
},

errorHandler: function(transaction, error){
     LOG.exception('Error : '+error.message+ ' (Code ' + error.code + ')');
},

I have a lot of successfull insert, except one throwing this message : Error : number of '?'s in statement string does not match argument count (Code 1)

But in the errorHandler, I don't know which query is throwing an error (because they are executed in asynchrone). The error object doesn't have the sql query executed. I think this is a very annoying lack of the HTML5 specification...

To solve my problem, I have wrapped all my insert in an unique transaction, and I set a name to the transaction (the only element in accessible in the errorHandler). But it's an hacky workaround...

Any idea to have more information in the error handler ?