about summary refs log tree commit diff stats
path: root/src/sqliteinterface.cpp
diff options
context:
space:
mode:
authorComradeCrow <comradecrow@vivaldi.net>2023-08-30 19:12:22 -0700
committerComradeCrow <comradecrow@vivaldi.net>2023-08-30 19:12:22 -0700
commit12df82c1a90208a822ebdf3d5f4994d55ef7cbea (patch)
treef4e55f053778a637803dd492ae1ac0dcd21ec309 /src/sqliteinterface.cpp
parentfd350c39ce8dab1ebb6bca94abf25e2e782086b3 (diff)
downloadytcpp-12df82c1a90208a822ebdf3d5f4994d55ef7cbea.tar.gz
update
Diffstat (limited to 'src/sqliteinterface.cpp')
-rw-r--r--src/sqliteinterface.cpp10
1 files changed, 10 insertions, 0 deletions
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) {