Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49258

Cordovasqlite asynchronous

$
0
0

@rsaravanan12 wrote:

Hi

How to disable or overcome sqlite asynchronous execution?

(Ex)

db.transaction(function(tx) {
var sql = "SELECT * FROM ot_student where id=(?)";
tx.executeSql(sql,[sel_date], function(tx ,res) {
if(res.rows.length > 0) {
for(var i = 0; i < res.rows.length; i++) {
var tmp = res.rows.item(i);
sql = "SELECT * FROM ot_scores where ts_id = "+tmp.id;
tx.executeSql(sql,[], function(dt_tx ,res_scores) {
tmp.scores = [];
for(var t = 0; t < res_scores.rows.length; t++) {
var tmp_scores = res_scores.rows.item(t);
tmp.scores.push(tmp_detail);
}
});
$scope.student.push(tmp);
}
}
});
});

$scope.avg_score = $scope.cal_scores();

$scope.cal_scores = function() {

// loop to calculate avg i got undefined for scores
}

Thanks

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49258

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>