Hi,

I would like to write a function within my QML project that inserts data into a SQLite table and returns the rowid of the inserted line on success.
This is what i got so far:
Qt Code:
  1. function saveData(name, mode, adjust) {
  2. var db = getDatabase();
  3. var res = "";
  4. db.transaction(function(tx) {
  5. var rs = tx.executeSql('INSERT INTO profiles ' +
  6. 'VALUES (?,?,?);', [name, mode, adjust]);
  7. if (rs.rowsAffected > 0) {
  8. res = tx.executeSql('SELECT last_insert_rowid();');
  9. } else {
  10. res = "Error";
  11. }
  12. });
  13. console.log(res)
  14. return res;
  15. }
To copy to clipboard, switch view to plain text mode 
But I do net get an integer back, I get an object. How is this done right and is there a better way to do it than what I tried?

Thanks.