@@ -303,30 +303,29 @@ void UploadQSODialog::processNextUploader()
303303 && currentTask.getServiceID () != QRZCOMID
304304 && currentTask.getServiceID () != WAVELOGID )
305305 {
306- const QString &statusField = currentTask.getDBUploadStatusFieldName ();
307- const QString &dateField = currentTask.getDBUploadDateFieldName ();
308- QString statement = QString (" UPDATE contacts "
309- " SET %1='Y', %2 = strftime('%Y-%m-%d',DATETIME('now', 'utc')) " ).arg (statusField,
310- dateField);
311306
312- statement.append (" WHERE " + currentTask.getWhereClause ());
307+ const QString statusField = currentTask.getDBUploadStatusFieldName ();
308+ const QString dateField = currentTask.getDBUploadDateFieldName ();
309+ const QList<qulonglong> idsToUpdate = currentTask.getQSOIDs ();
313310
314- if ( !ui->myCallsignCombo ->currentText ().isEmpty () )
315- statement.append (" AND COALESCE(NULLIF(TRIM(station_callsign), ''), TRIM(operator)) = '" + ui->myCallsignCombo ->currentText ().trimmed () + " '" );
311+ QStringList idStrings;
316312
317- if ( !ui-> myGridCombo -> currentText (). isEmpty () && ui-> myGridCombo -> currentIndex () > 0 )
318- statement .append (" AND my_gridsquare = ' " + ui-> myGridCombo -> currentText (). trimmed () + " ' " );
313+ for ( qulonglong id : idsToUpdate )
314+ idStrings .append (QString::number (id) );
319315
320- qCDebug (runtime) << statement;
316+ QString statement = QString (" UPDATE contacts "
317+ " SET %1='Y', %2 = strftime('%Y-%m-%d',DATETIME('now', 'utc')) "
318+ " WHERE id IN (%3) " ).arg (statusField, dateField, idStrings.join (" ," ));
321319
322- QSqlQuery updateQuery (statement);
320+ QSqlQuery updateQuery;
321+ updateQuery.prepare (statement);
323322
324323 if ( !updateQuery.exec () )
325324 qWarning () << " Cannot update" << currentTask.getServiceName ()
326325 << " Upload status in DB" << updateQuery.lastError ().text ();
327326 else
328327 currentTask.updateAllDBFieldValue (statusField, " Y" ,
329- dateField, " 2025-05-13 " );
328+ dateField, QDateTime::currentDateTimeUtc (). date (). toString (Qt::ISODate) );
330329 }
331330 processNextUploader ();
332331 });
@@ -480,7 +479,6 @@ void UploadQSODialog::executeQuery()
480479 const QString serviceSelectCondition = whereTemplate.arg (task.getDBUploadStatusFieldName (),
481480 uploadStatuses.join (" ," ),
482481 addlCondition);
483- task.setWhereClause (serviceSelectCondition);
484482 serviceSelectConditions << serviceSelectCondition;
485483 serviceStatusColumns << statusColumnTemplate.arg (serviceSelectCondition,
486484 QString::number (task.getServiceID ()));
0 commit comments