feat: add SQL/SQLite, AppSec, Capstone incident-tracker, Gitea Actions CI and spaced repetition
Test and Lint / quality (push) Successful in 1m50s
Test and Lint / quality (push) Successful in 1m50s
This commit is contained in:
1 parent
015eae08c3
commit
9130af822e
19 files changed
+722
-7
No files matched your search
@@ -0,0 +1,14 @@
|
||||
# 05 — SQL i SQLite (`rusqlite`, parametryzowane zapytania, ochrona przed SQLi)
|
||||
|
||||
Teoria: [notes/06-sql-and-databases.md](../../../notes/06-sql-and-databases.md)
|
||||
|
||||
## Zadania (`src/lib.rs`)
|
||||
Zaimplementuj `ServiceRegistry` na `rusqlite`:
|
||||
1. `init_schema(&self) -> rusqlite::Result<()>` — `CREATE TABLE IF NOT EXISTS services(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, owner TEXT NOT NULL)`.
|
||||
2. `register(&self, name: &str, owner: &str) -> rusqlite::Result<i64>` — parametryzowany `INSERT` (`params![name, owner]`) i `self.conn.last_insert_rowid()`.
|
||||
3. `find_by_owner(&self, owner: &str) -> rusqlite::Result<Vec<String>>` — posortowana lista nazw bez podatności na SQL Injection.
|
||||
|
||||
## Uruchomienie testów
|
||||
```bash
|
||||
make test PKG=eco05-sql-sqlite
|
||||
```
|
||||
Reference in new issue
Block a user