mercredi 28 octobre 2015

executing sqlite query asynchronous

is there any way to execute sqlite query in an asynchronous way in javascript ???

and if not , how is handling the error of synchronous execution way in the code below!?

var db = openConn('instabartar' , '1.0' , 'Insta Bartar', 200000);
db.transaction(insertUserInformation , errorDB ,successDB );

      function insertUserInformation(tx){
            tx.executeSql('CREATE TABLE IF NOT EXISTS USERINFO (ID UNIQUE, USERNAME , FULLNAME , PROFILEPIC , ACCESS_TOKEN)');

      }

    function openConn(databaseName, dbVersion, dbShowName, dbSize){
        return window.openDatabase(databaseName, dbVersion, dbShowName, dbSize);
     }

    function errorDB(tx, err) {
        console.log("Error processing SQL: " , err);
        return err;
        //alert("Error processing SQL: " + err);
    }

    function successDB() {
        console.log("success!" );
        return "success";
    }

Aucun commentaire:

Enregistrer un commentaire