]> Some of my projects - localmylist.git/commitdiff
Fix INSERT statements to account for new columns
authorAPTX <marek321@gmail.com>
Sun, 7 Apr 2013 19:21:57 +0000 (21:21 +0200)
committerAPTX <marek321@gmail.com>
Sun, 7 Apr 2013 19:21:57 +0000 (21:21 +0200)
localmylist/database.cpp

index 676d61f223b6f2074e5ad0ec88471fa5ef570087..cf454a6ee0c651dd294e89af35d3ca727ac9fa79 100644 (file)
@@ -292,10 +292,14 @@ int Database::isKnownFile(const QByteArray &ed2k, qint64 size)
 
 bool Database::addFileLocation(const FileLocation &fileLocation)
 {
-       QSqlQuery &q = prepare("INSERT INTO file_location VALUES(DEFAULT, :fid, :hostId, :path, DEFAULT, DEFAULT)");
+       QSqlQuery &q = prepare(
+       "INSERT INTO file_location VALUES(DEFAULT, :fid, :hostId, :path, "
+       "               :renameDisabled, :originalName, DEFAULT, DEFAULT, DEFAULT, DEFAULT)");
        q.bindValue(":fid", fileLocation.fid);
        q.bindValue(":hostId", fileLocation.hostId);
        q.bindValue(":path", fileLocation.path);
+       q.bindValue(":renameDisabled", false);
+       q.bindValue(":originalName", "");
 
        return exec(q);
 }
@@ -739,9 +743,9 @@ bool Database::addEpisode(const Episode &episode)
 bool Database::addFile(const File &file)
 {
        QSqlQuery &q = prepare(
-       "INSERT INTO file VALUES(:fid, :eid, :aid, :gid, DEFAULT, :anidbUpdate, :entryUpdate, :myUpdate, "
+       "INSERT INTO file VALUES(:fid, :eid, :aid, :gid, :lid, DEFAULT, :anidbUpdate, :entryUpdate, :myUpdate, "
        "               :ed2k, :size, :length, :extension, :groupName, :groupNameShort, "
-       "               :crc, :releaseDate, :version, :censored, :source, :qualityId, "
+       "               :crc, :releaseDate, :version, :censored, :deprecated, :source, :qualityId, "
        "               :quality, :resolution, :vidoeCodec, :audioCodec, :audioLanguage, "
        "               :subtitleLanguage, :aspectRatio, :myWatched, :myState, "
        "               :myFileState, :myStorage, :mySource, :myOther) ");
@@ -750,6 +754,7 @@ bool Database::addFile(const File &file)
        q.bindValue(":eid", file.eid);
        q.bindValue(":aid", file.aid);
        q.bindValue(":gid", file.gid);
+       q.bindValue(":lid", 0);
        q.bindValue(":anidbUpdate", file.anidbUpdate);
        q.bindValue(":entryUpdate", file.entryUpdate);
        q.bindValue(":myUpdate", file.myUpdate);
@@ -763,6 +768,7 @@ bool Database::addFile(const File &file)
        q.bindValue(":releaseDate", file.releaseDate);
        q.bindValue(":version", file.version);
        q.bindValue(":censored", file.censored);
+       q.bindValue(":deprecated", false);
        q.bindValue(":source", file.source);
        q.bindValue(":qualityId", file.qualityId);
        q.bindValue(":quality", file.quality);
@@ -941,11 +947,17 @@ bool Database::clearRequest(const PendingRequest &request)
 bool Database::addPendingMyListUpdate(const PendingMyListUpdate &request)
 {
        QSqlQuery &q = prepare(
-       "INSERT INTO pending_mylist_update VALUES(DEFAULT, :fid, :setMyWatched, :myWatched, "
-       "               :setMyState, :myState, :setMyFileState, :myFileState, :setMyStorage, :myStorage, "
-       "               :setMySource, :mySource, :setMyOther, :myOther, DEFAULT, DEFAULT, DEFAULT, DEFAULT) ");
+       "INSERT INTO pending_mylist_update VALUES(DEFAULT, :fid, :aid, :epno, :epmin, :eptype, "
+       "               :setMyWatched, :myWatched, :setMyState, :myState, :setMyFileState, "
+       "               :myFileState, :setMyStorage, :myStorage, :setMySource, :mySource, "
+       "               :setMyOther, :myOther, :setVote, :vote, "
+       "               DEFAULT, DEFAULT, DEFAULT, DEFAULT) ");
 
        q.bindValue(":fid", request.fid);
+       q.bindValue(":aid", 0);
+       q.bindValue(":epno", 0);
+       q.bindValue(":epmin", 0);
+       q.bindValue(":eptype", "");
        q.bindValue(":setMyWatched", request.setMyWatched);
        q.bindValue(":myWatched", request.myWatched);
        q.bindValue(":setMyState", request.setMyState);
@@ -958,6 +970,8 @@ bool Database::addPendingMyListUpdate(const PendingMyListUpdate &request)
        q.bindValue(":mySource", request.mySource);
        q.bindValue(":setMyOther", request.setMyOther);
        q.bindValue(":myOther", request.myOther);
+       q.bindValue(":setVote", false);
+       q.bindValue(":vote", 0);
 
        return exec(q);
 }