MCPcopy Create free account
hub / github.com/OpenBoardView/OpenBoardView / Remove

Method Remove

src/openboardview/Annotations.cpp:197–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195}
196
197bool Annotations::Remove(int id) {
198 static const char sql[] = "UPDATE annotations SET visible = 0 WHERE id=?;";
199
200 sqlite3_stmt *stmt;
201 int r = sqlite3_prepare_v2(sqldb, sql, -1, &stmt, NULL);
202 if (r != SQLITE_OK) {
203 SDL_LogError(SDL_LOG_CATEGORY_ERROR, "Annotations UPDATE statement could not be prepared: %s", sqlite3_errmsg(sqldb));
204 return false;
205 }
206
207 r = sqlite3_bind_int(stmt, 1, id);
208
209 if (r != SQLITE_OK) {
210 SDL_LogError(SDL_LOG_CATEGORY_ERROR, "Annotations UPDATE statement parameter could not be bound: %s", sqlite3_errmsg(sqldb));
211 r = sqlite3_finalize(stmt);
212 return false;
213 }
214
215 r = sqlite3_step(stmt);
216
217 r = sqlite3_finalize(stmt);
218
219 if (r != SQLITE_DONE && r != SQLITE_OK) {
220 SDL_LogError(SDL_LOG_CATEGORY_ERROR, "Annotations UPDATE statement failed: %s", sqlite3_errmsg(sqldb));
221 return false;
222 }
223
224 return true;
225}
226
227bool Annotations::Update(int id, const std::string &note) {
228 static const char sql[] = "UPDATE annotations SET note = ? WHERE id=?;";

Callers 1

ContextMenuMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected