From 12df82c1a90208a822ebdf3d5f4994d55ef7cbea Mon Sep 17 00:00:00 2001 From: ComradeCrow Date: Wed, 30 Aug 2023 19:12:22 -0700 Subject: update --- src/sqliteinterface.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/sqliteinterface.cpp') diff --git a/src/sqliteinterface.cpp b/src/sqliteinterface.cpp index 7cf14dc..97a13e6 100644 --- a/src/sqliteinterface.cpp +++ b/src/sqliteinterface.cpp @@ -76,6 +76,16 @@ void SqliteInterface::saveInstance(const char *uri, float health, const char * } } +void SqliteInterface::saveInstance(const InvidiousApi::instance& inst) { + + char *errmsg = 0; + int rc = sqlite3_exec(db, sqlite3_mprintf("REPLACE INTO INSTANCES VALUES(%Q, '%.3f', %Q);", inst.url, inst.health, inst.location), callback, 0, &errmsg); + if( rc != SQLITE_OK ){ + fprintf(stderr, "SQL error: %s\n", errmsg); + sqlite3_free(errmsg); + } +} + void SqliteInterface::saveVideo(const Video::video& vid) { -- cgit 1.4.1-2-gfad0