Добавлены описания
This commit is contained in:
parent
8716a90463
commit
8639c36f46
8 changed files with 388 additions and 34 deletions
|
@ -369,10 +369,24 @@ public:
|
|||
long deleteSnapshot(long id) {
|
||||
auto queryResult = sql("DELETE FROM snapshots WHERE id = ? RETURNING id", id);
|
||||
|
||||
if (queryResult.empty()) {
|
||||
throw new Exception("Ошибка при удалении снимка из базы данных");
|
||||
if (!queryResult.empty()) {
|
||||
return queryResult.front()["id"].to!long;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
long deleteSnapshot(string label) {
|
||||
auto queryResult = sql(
|
||||
q{
|
||||
DELETE FROM snapshots
|
||||
WHERE label = ?
|
||||
RETURNING 1;
|
||||
}, label);
|
||||
|
||||
if (!queryResult.empty()) {
|
||||
return queryResult.length.to!long;
|
||||
}
|
||||
|
||||
return queryResult.front()["id"].to!long;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,6 +137,23 @@ public:
|
|||
return snapshot;
|
||||
}
|
||||
|
||||
// Удаляет снимок по метке, возвращает количество удаленных снимков
|
||||
long removeSnapshots(string label) {
|
||||
return _db.deleteSnapshot(label);
|
||||
}
|
||||
|
||||
bool removeSnapshots(Snapshot snapshot) {
|
||||
return removeSnapshots(snapshot.id);
|
||||
}
|
||||
|
||||
bool removeSnapshots(long idSnapshot) {
|
||||
return _db.deleteSnapshot(idSnapshot) == idSnapshot;
|
||||
}
|
||||
|
||||
Snapshot getSnapshot(long idSnapshot) {
|
||||
return new Snapshot(_db, idSnapshot);
|
||||
}
|
||||
|
||||
Snapshot[] getSnapshots(string label = string.init) {
|
||||
Snapshot[] snapshots;
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module cdcdb.version_;
|
||||
|
||||
enum cdcdbVersion = "0.0.1";
|
||||
enum cdcdbVersion = "0.1.0";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue