From: APTX Date: Tue, 9 Apr 2013 15:53:27 +0000 (+0200) Subject: Update addFileLocation/setFileLocation to use the new fields X-Git-Url: https://gitweb.aptx.org/?a=commitdiff_plain;h=62533d0863bb6b518fb0c72789e8d213d8f44a49;p=localmylist.git Update addFileLocation/setFileLocation to use the new fields --- diff --git a/localmylist/database.cpp b/localmylist/database.cpp index 380f916..dd2802c 100644 --- a/localmylist/database.cpp +++ b/localmylist/database.cpp @@ -299,39 +299,32 @@ bool Database::addFileLocation(const FileLocation &fileLocation) q.bindValue(":hostId", fileLocation.hostId); q.bindValue(":path", fileLocation.path); q.bindValue(":renameDisabled", false); - q.bindValue(":originalName", ""); + q.bindValue(":originalName", fileLocation.originalName); return exec(q); } bool Database::setFileLocation(const FileLocation &fileLocation) { + // original_name is skipped on purpose! QSqlQuery &q = prepare( - "UPDATE file_location SET fid = :fid, host_id = :hostId, path = :path, renamed = :renamed, " - " failed_rename = :failedRename " + "UPDATE file_location SET fid = :fid, host_id = :hostId, path = :path, " + " rename_disabled = :renameDisabled, renamed = :renamed, " + " rename_path = :renamePath, failed_rename = :failedRename, " + " rename_error = :renameRrror " " WHERE location_id = :locationId"); q.bindValue(":locationId", fileLocation.locationId); q.bindValue(":fid", fileLocation.fid); q.bindValue(":hostId", fileLocation.hostId); q.bindValue(":path", fileLocation.path); + q.bindValue(":renameDisabled", fileLocation.renameDisabled); q.bindValue(":renamed", fileLocation.renamed); + q.bindValue(":renamePath", fileLocation.renamePath); q.bindValue(":failedRename", fileLocation.failedRename); + q.bindValue(":renameError", fileLocation.renameError); return exec(q); - if (!exec(q)) - return false; - - if (q.numRowsAffected()) - return true; - - { - QSqlQuery &q = prepare( - "UPDATE file_location SET failed_rename = true " - " WHERE location_id = :locationId"); - q.bindValue(":locationId", fileLocation.locationId); - return exec(q); - } } Anime Database::getAnime(int aid)