diff --git a/models/CabrilloLog.cpp b/models/CabrilloLog.cpp index aaedd3bd1..3a30380e3 100644 --- a/models/CabrilloLog.cpp +++ b/models/CabrilloLog.cpp @@ -46,10 +46,25 @@ CabrilloLog::impl::impl (Configuration const * configuration) } SQL_error_check (dupe_query_, &QSqlQuery::prepare, - "SELECT COUNT(*) FROM cabrillo_log WHERE call = :call AND band = :band"); + "SELECT " + " COUNT(*) " + " FROM " + " cabrillo_log " + " WHERE " + " call = :call " + " AND band = :band"); SQL_error_check (export_query_, &QSqlQuery::prepare, - "SELECT frequency, \"when\", exchange_sent, call, exchange_rcvd FROM cabrillo_log ORDER BY \"when\""); + "SELECT " + " frequency" + " , \"when\"" + " , exchange_sent" + " , call" + " , exchange_rcvd" + " FROM " + " cabrillo_log " + " ORDER BY " + " \"when\""); setEditStrategy (QSqlTableModel::OnFieldChange); setTable ("cabrillo_log"); @@ -138,6 +153,8 @@ bool CabrilloLog::dupe (Frequency frequency, QString const& call) const void CabrilloLog::reset () { + // synchronize model + while (m_->canFetchMore ()) m_->fetchMore (); if (m_->rowCount ()) { m_->setEditStrategy (QSqlTableModel::OnManualSubmit); diff --git a/models/FoxLog.cpp b/models/FoxLog.cpp index 504ddd2a8..773a5308f 100644 --- a/models/FoxLog.cpp +++ b/models/FoxLog.cpp @@ -46,10 +46,26 @@ FoxLog::impl::impl (Configuration const * configuration) } SQL_error_check (dupe_query_, &QSqlQuery::prepare, - "SELECT COUNT(*) FROM fox_log WHERE call = :call AND band = :band"); + "SELECT " + " COUNT(*) " + " FROM " + " fox_log " + " WHERE " + " call = :call " + " AND band = :band"); SQL_error_check (export_query_, &QSqlQuery::prepare, - "SELECT band, \"when\", call, grid, report_sent, report_rcvd FROM fox_log ORDER BY \"when\""); + "SELECT " + " band" + " , \"when\"" + " , call" + " , grid" + " , report_sent" + " , report_rcvd " + " FROM " + " fox_log " + " ORDER BY " + " \"when\""); setEditStrategy (QSqlTableModel::OnFieldChange); setTable ("fox_log"); @@ -141,6 +157,8 @@ bool FoxLog::dupe (QString const& call, QString const& band) const void FoxLog::reset () { + // synchronize model + while (m_->canFetchMore ()) m_->fetchMore (); if (m_->rowCount ()) { m_->setEditStrategy (QSqlTableModel::OnManualSubmit);