Created
August 5, 2015 15:45
-
-
Save bbeamer/5384497e0444f6705ad3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//global variable | |
var id=[]; | |
//declare a promise to handle this treatement | |
//would be nice to call the same code many times | |
//use it as a function | |
Task.spawn(function* () { | |
let db = yield Sqlite.openConnection({ path: myPath}); | |
try { | |
let row = yield db.execute( | |
"SELECT id FROM 'plates'"); | |
for ( i=0; i < row.length; i++) { | |
console.log("row["+ i +"] :" + row[i].getResultByIndex(0)); | |
id.push(row[i].getResultByIndex(0)); | |
} | |
} | |
finally { | |
yield db.close(); | |
} | |
}); | |
console.log("id length:"+id.length); | |
for (i=0; i<id.length; i++) | |
console.log(i+" "+id[i]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment