Under Construction
SQL Prepared Statement
// Update a todo item .
// update :: (Database, Number, Todo) -> ()
export async function update(db , id , todo)) {
const sql = `UPDATE todo
SET title=$title ,date=$date, due_date=$due_date,status_id=$status_id, user_id=$user_id
WHERE todo.id=$id;
`;
await db.run( sql, {
$id: id,
$title: todo.title,
$date: todo.date,
$due_date: todo.due_date,
$status_id: todo.status_id,
});
await Tags.saveForId(db, id, todo.tags);
return;
}
Synchron/Asynchron
- Synchron: Eingabe unterbricht Programmlauf
- Asynchron: Eingabe, Programm läuft weiter und wird beanchrichtigt, sobald
Eingabe erfolgt ist.
PHP kann kein ORM
Installation
Die Datenbankschnittstelle wird per npm installiert. Beispiel SQLite:
npm install sqlite
Für Wechsel zwischen Plattformen
rm -R node_modules
npm istall # alle Module neu installieren