diff options
-rw-r--r-- | src/client.c | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/src/client.c b/src/client.c index 18a3784..3422ad0 100644 --- a/src/client.c +++ b/src/client.c @@ -906,38 +906,10 @@ static bool og_dbi_update_image(struct og_dbi *dbi, const struct og_image_legacy *img_info, const char *computer_id) { - int repo_id, sw_id, repo_alias; const char *msglog; dbi_result result; uint32_t revision; - - /* find repository identifier by repository ip and computer ID. */ - result = dbi_conn_queryf(dbi->conn, - "SELECT repositorios.idrepositorio, repositorios.alias" - " FROM repositorios" - " LEFT JOIN ordenadores USING (idrepositorio)" - " WHERE repositorios.ip='%s' AND ordenadores.idordenador=%s", - img_info->repo, computer_id); - if (!result) { - dbi_conn_error(dbi->conn, &msglog); - syslog(LOG_ERR, "failed to query database (%s:%d) %s\n", - __func__, __LINE__, msglog); - return false; - } - if (!dbi_result_next_row(result)) { - syslog(LOG_ERR, - "repository does not exist in database (%s:%d)\n", - __func__, __LINE__); - dbi_result_free(result); - return false; - } - repo_alias = dbi_result_get_uint(result, "alias"); - if (repo_alias) - repo_id = repo_alias; - else - repo_id = dbi_result_get_uint(result, "idrepositorio"); - - dbi_result_free(result); + int sw_id; /* find software id by computer ID, disk number and partition. */ result = dbi_conn_queryf(dbi->conn, @@ -965,11 +937,11 @@ static bool og_dbi_update_image(struct og_dbi *dbi, result = dbi_conn_queryf(dbi->conn, "UPDATE imagenes" " SET idordenador=%s, numdisk=%s, numpar=%s, codpar=%s," - " idperfilsoft=%d, idrepositorio=%d," + " idperfilsoft=%d, " " fechacreacion=NOW(), revision=revision+1" " WHERE idimagen=%s", computer_id, img_info->disk, img_info->part, img_info->code, - sw_id, repo_id, img_info->image_id); + sw_id, img_info->image_id); if (!result) { dbi_conn_error(dbi->conn, &msglog); |