Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

134
Views
cordova-sqlite-storage synchronous two selects - JavaScript

I have a question about Cordova and the Cordova-Sqlite-Storage Plugin.

I want to select two tables, but the second selection is in the loop of the first. But it is not synchronized.

The code isn't productive or anything, it's purposely easy to understand.

document.addEventListener('deviceready', function(){
    var rooms_id_arr = [];
    
    db.transaction(function(tx){
        tx.executeSql('SELECT id FROM rooms', [], function(tx, result_rooms){
            for(var r = 0; r < result_rooms.rows.length; r++){
                rooms_id_arr.push(result_rooms.rows.item(r).id);
            }
        }, function(tx, error) {
            alert("ERROR A: " + error.message);
        });
        for(var r = 0; r < rooms_id_arr.length; r++){
            tx.executeSql('SELECT id FROM regal WHERE roomid=?' , [rooms_id_arr[r]], function(tx, result_regal){
                for(var rg = 0; rg < result_regal.rows.length; rg++){
                    alert("Room: " + r + " Regal: " + rg);
                }
            }, function(tx, error) {
                alert("ERROR B: " + error.message);
            });
        }
    });
});

First Table (rooms): id, name

Secound Table (regal): id, roomid (key from table rooms), name

Every room have more shelves. i know how joins work, i would like to know how to do it that way (for understand). How could this best be implemented? i have tried many options, but have not come to any result. Thank you very much for your answer.

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!