Save to database #13

Merged
haylan merged 42 commits from save-to-database into main 2026-07-12 21:51:57 +00:00
Showing only changes of commit c929fdfda6 - Show all commits
+25 -1
View File
@@ -25,11 +25,35 @@ class ContributionStore {
$this->pdo->exec('
CREATE TABLE IF NOT EXISTS contributions (
provider TEXT NOT NULL,
date TEXT NOT NULL,
date INTEGER NOT NULL,
count INTEGER NOT NULL CHECK (count >= 0),
PRIMARY KEY (provider, date)
) WITHOUT ROWID, STRICT
');
}
public function add(string $provider, int $unixtime, int $count):void{
$stmt = $this->pdo->prepare('
INSERT INTO contributions (
provider, date, count
)
VALUES(
?,?,?
)
');
$stmt->execute([$provider,$unixtime,$count]);
}
public function remove(string $provider, int $unixtime):void{
$stmt = $this->pdo->prepare('
DELETE contributions
WHERE provider LIKE ? and date = ?
');
$stmt->execute([$provider,$unixtime]);
}
public function all():void{
}
}