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

100
Views
React Native SQLLite execute function before going on

I need the lasted Insert ID for the upcomming foreign Key beacuse i'm importing lists. It always executes the for loop first so i made an Manually Insertion for the last id and it should go on when the Actual ID can be inserted but how can i solve this problem?

Insert.js

 export const actualRennenID = () =>{
    return true;
 };
 export const rennenhinzufuegen = (datum, name) =>{
  var rennenID = 0;
  var db = SQLite.openDatabase('skirennen.db', '1.0', 'Alle Rennen der Skilehrer', 200000, openCB, errorCB);
  db.transaction( (tx) => {
   /* tx.executeSql('DROP TABLE gruppen',
    [],
    (tx, results) => { */
    tx.executeSql('INSERT INTO rennen (rennName, datum) VALUES (?,?);', 
    [name, datum],
    (tx, results) => {
      this.iDRennen = results.insertId;
      actualRennenID();
      console.log('rennen Hinzugefuegt mit ID ' + iDRennen); 
  });
  
});
return this.iDRennen;
}

Main.js

 var iDRennen = rennenhinzufuegen(date, nameRennen);
        
  var rennListeEInfuegenAusgefuehrt = false;
  rennListeEInfuegenAusgefuehrt = actualRennenID();
  console.log('Before IF');
  if(rennListeEInfuegenAusgefuehrt == 13){
     for(var c =0; c< reihen.length; c++){... 
nextInsertStatment(iDRennen);
}}

Is there a way, the insert database function run first?

Thanks!

`

about 4 years ago · Juan Pablo Isaza
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!