- const query =
- "INSERT INTO Problems (added, vid, fen, instructions, solution) VALUES " +
- "(" +
- Date.now() + "," +
- vid + "," +
- fen + "," +
- instructions + "," +
- solution +
- ")";
- db.run(query);
+ const insertQuery =
+ "INSERT INTO Problems (added, uid, vid, fen, instructions, solution) " +
+ "VALUES (" + Date.now() + "," + uid + "," + vid + ",'" + fen + "',?,?)";
+ db.run(insertQuery, [instructions, solution], err => {
+ if (!!err)
+ return cb(err);
+ db.get("SELECT last_insert_rowid() AS rowid", cb);
+ });
+// const stmt = db.prepare(query);
+// stmt.run(instructions, solution);
+// stmt.finalize();