Ticket #2534: mythplugins-mythvideo-dbcheck_mysql3_compat.patch
File mythplugins-mythvideo-dbcheck_mysql3_compat.patch, 1.2 KB (added by , 18 years ago) |
---|
-
mythvideo/mythvideo/dbcheck.cpp
227 227 228 228 if (dbver == "1008") 229 229 { 230 const QString updates[] = { 231 "UPDATE videometadata " 232 "LEFT JOIN videocategory ON (videometadata.category = videocategory.intid) " 233 "SET videometadata.category = 0 " 234 "WHERE videocategory.intid IS NULL;", 235 "" 236 }; 230 QStringList updates; 237 231 232 MSqlQuery query(MSqlQuery::InitCon()); 233 query.exec("SELECT intid FROM videocategory;"); 234 235 QString categoryIDs = "'0',"; 236 if (query.isActive() && query.size()) 237 { 238 while (query.next()) 239 { 240 categoryIDs += "'" + query.value(0).toString() + "',"; 241 } 242 categoryIDs = categoryIDs.left(categoryIDs.length() - 1); 243 updates.append(QString( 244 "UPDATE videometadata SET category = 0 WHERE category NOT IN (%1);") 245 .arg(categoryIDs)); 246 } 247 else 248 { 249 updates.append("SELECT 1;"); 250 } 251 238 252 performActualUpdate(updates, "1009", dbver); 239 253 } 240 254