]> Some of my projects - localmylist.git/commitdiff
Fix setFileLocation typo/null values.
authorAPTX <marek321@gmail.com>
Sat, 13 Apr 2013 15:10:52 +0000 (17:10 +0200)
committerAPTX <marek321@gmail.com>
Sat, 13 Apr 2013 15:10:52 +0000 (17:10 +0200)
localmylist/database.cpp

index 80ca8b82749b718f06375d77fc59365b6e24566f..63f05320f90d965016be974c2846a20465f04184 100644 (file)
@@ -322,9 +322,9 @@ bool Database::addFileLocation(const FileLocation &fileLocation)
        "               :renameDisabled, :originalName, DEFAULT, DEFAULT, DEFAULT, DEFAULT)");
        q.bindValue(":fid", fileLocation.fid);
        q.bindValue(":hostId", fileLocation.hostId);
-       q.bindValue(":path", fileLocation.path);
+       q.bindValue(":path", fileLocation.path.isNull() ? "" : fileLocation.path);
        q.bindValue(":renameDisabled", false);
-       q.bindValue(":originalName", fileLocation.originalName);
+       q.bindValue(":originalName", fileLocation.originalName.isNull() ? "" : fileLocation.originalName);
 
        return exec(q);
 }
@@ -336,7 +336,7 @@ bool Database::setFileLocation(const FileLocation &fileLocation)
        "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 "
+       "               rename_error = :renameError "
        "       WHERE location_id = :locationId");
 
        q.bindValue(":locationId", fileLocation.locationId);
@@ -345,9 +345,9 @@ bool Database::setFileLocation(const FileLocation &fileLocation)
        q.bindValue(":path", fileLocation.path);
        q.bindValue(":renameDisabled", fileLocation.renameDisabled);
        q.bindValue(":renamed", fileLocation.renamed);
-       q.bindValue(":renamePath", fileLocation.renamePath);
+       q.bindValue(":renamePath", fileLocation.renamePath.isNull() ? "" : fileLocation.renamePath);
        q.bindValue(":failedRename", fileLocation.failedRename);
-       q.bindValue(":renameError", fileLocation.renameError);
+       q.bindValue(":renameError", fileLocation.renameError.isNull() ? "" : fileLocation.renameError);
 
        return exec(q);
 }