Report exact DM SQL prepare errors without duplicate step failures
This commit is contained in:
1 parent
497792da73
commit
3987295707
1 file changed
+5
-4
+5
-4
@@ -57,8 +57,9 @@ struct dm_file_job {
|
||||
|
||||
sqlite3_stmt* dm_media_prepare(struct UTUN_INSTANCE* inst, const char* sql) {
|
||||
sqlite3_stmt* st = NULL;
|
||||
if (sqlite3_prepare_v2(inst->topo_sqlite_db, sql, -1, &st, NULL) != SQLITE_OK)
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_DM, "dm_media: SQL prepare failed: %s statement=%s", sqlite3_errmsg(inst->topo_sqlite_db), sql);
|
||||
int rc = sqlite3_prepare_v2(inst->topo_sqlite_db, sql, -1, &st, NULL);
|
||||
if (rc != SQLITE_OK)
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_DM, "dm_media: SQL prepare rc=%d error=%s statement=%s", rc, sqlite3_errmsg(inst->topo_sqlite_db), sql);
|
||||
return st;
|
||||
}
|
||||
|
||||
@@ -69,8 +70,8 @@ int dm_media_step(struct UTUN_INSTANCE* inst, sqlite3_stmt* st) {
|
||||
if (rc != SQLITE_DONE) DEBUG_ERROR(DEBUG_CATEGORY_DM, "dm_media: SQL step rc=%d error=%s statement=%s",
|
||||
rc, sqlite3_errmsg(inst->topo_sqlite_db), sqlite3_sql(st));
|
||||
int final = sqlite3_finalize(st);
|
||||
if (final != SQLITE_OK) DEBUG_ERROR(DEBUG_CATEGORY_DM, "dm_media: SQL finalize rc=%d step=%d error=%s",
|
||||
final, rc, sqlite3_errmsg(inst->topo_sqlite_db));
|
||||
if (rc == SQLITE_DONE && final != SQLITE_OK)
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_DM, "dm_media: SQL finalize rc=%d step=%d error=%s", final, rc, sqlite3_errmsg(inst->topo_sqlite_db));
|
||||
return rc == SQLITE_DONE && final == SQLITE_OK ? 0 : -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user