Cordova Database: Orchestration not quite clear -> handler for any result needed

11 views Asked by At

I am querying my database using this generic method:

 oBusyIndicator.open();
 db.transaction(function(tx){
     fireQuery(tx, sQuery, fSuccessCallback, fErrorCallback)
 }, fWhateverErrorCallback);

This method takes the query string and does the transaction processing:

function fireQuery(tx, sQuery, fSuccessCallback, fErrorCallback) {
    tx.executeSql(sQuery, [], fSuccessCallback, fErrorCallback);
}

You see the busy indicator being opened but how can I hide it without the need of doing it in the specific handlers?

Cheers

1

There are 1 answers

0
AntonSack On

OK, this way works:

db.transaction(function(tx){
                fireQuery(tx, sQuery, function(tx, oResultset){
                        // do whatever necessary
                        fSuccessCallback(oResultset);
                }, fErrorCallback
                )
            }, queryFailed);