Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

React Native SQLLite execute function before going on

$
0
0

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!

`


Viewing all articles
Browse latest Browse all 6287

Trending Articles



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