mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-25 21:58:38 -05:00
Use a new name for the revised cabrillo_log(_v2) database table
This avoids most backward compatibility issues but contest logs cannot be carried forward to v2.1.0.
This commit is contained in:
parent
19c46774b4
commit
80c819c326
@ -84,26 +84,13 @@ CabrilloLog::impl::impl (CabrilloLog * self, Configuration const * configuration
|
|||||||
, configuration_ {configuration}
|
, configuration_ {configuration}
|
||||||
, adding_row_ {false}
|
, adding_row_ {false}
|
||||||
{
|
{
|
||||||
if (!database ().tables ().contains ("cabrillo_log"))
|
if (!database ().tables ().contains ("cabrillo_log_v2"))
|
||||||
{
|
{
|
||||||
create_table ();
|
create_table ();
|
||||||
}
|
}
|
||||||
|
|
||||||
setEditStrategy (QSqlTableModel::OnFieldChange);
|
setEditStrategy (QSqlTableModel::OnFieldChange);
|
||||||
setTable ("cabrillo_log");
|
setTable ("cabrillo_log_v2");
|
||||||
if (-1 != fieldIndex ("band")) // schema out of date
|
|
||||||
{
|
|
||||||
QSqlQuery query;
|
|
||||||
SQL_error_check (query, static_cast<bool (QSqlQuery::*) (QString const&)> (&QSqlQuery::exec),
|
|
||||||
"DROP TABLE IF EXISTS cabrillo_log_backup");
|
|
||||||
SQL_error_check (query, static_cast<bool (QSqlQuery::*) (QString const&)> (&QSqlQuery::exec),
|
|
||||||
"CREATE TABLE cabrillo_log_backup AS SELECT * FROM cabrillo_log");
|
|
||||||
SQL_error_check (query, static_cast<bool (QSqlQuery::*) (QString const&)> (&QSqlQuery::exec),
|
|
||||||
"DROP TABLE cabrillo_log");
|
|
||||||
create_table ();
|
|
||||||
setTable ("cabrillo_log");
|
|
||||||
}
|
|
||||||
|
|
||||||
setHeaderData (fieldIndex ("frequency"), Qt::Horizontal, tr ("Freq(MHz)"));
|
setHeaderData (fieldIndex ("frequency"), Qt::Horizontal, tr ("Freq(MHz)"));
|
||||||
setHeaderData (fieldIndex ("mode"), Qt::Horizontal, tr ("Mode"));
|
setHeaderData (fieldIndex ("mode"), Qt::Horizontal, tr ("Mode"));
|
||||||
setHeaderData (fieldIndex ("when"), Qt::Horizontal, tr ("Date & Time(UTC)"));
|
setHeaderData (fieldIndex ("when"), Qt::Horizontal, tr ("Date & Time(UTC)"));
|
||||||
@ -133,7 +120,7 @@ CabrilloLog::impl::impl (CabrilloLog * self, Configuration const * configuration
|
|||||||
"SELECT "
|
"SELECT "
|
||||||
" frequency "
|
" frequency "
|
||||||
" FROM "
|
" FROM "
|
||||||
" cabrillo_log "
|
" cabrillo_log_v2 "
|
||||||
" WHERE "
|
" WHERE "
|
||||||
" call = :call ");
|
" call = :call ");
|
||||||
|
|
||||||
@ -145,7 +132,7 @@ CabrilloLog::impl::impl (CabrilloLog * self, Configuration const * configuration
|
|||||||
" , call"
|
" , call"
|
||||||
" , exchange_rcvd"
|
" , exchange_rcvd"
|
||||||
" FROM "
|
" FROM "
|
||||||
" cabrillo_log "
|
" cabrillo_log_v2 "
|
||||||
" ORDER BY "
|
" ORDER BY "
|
||||||
" \"when\"");
|
" \"when\"");
|
||||||
}
|
}
|
||||||
@ -154,7 +141,7 @@ void CabrilloLog::impl::create_table ()
|
|||||||
{
|
{
|
||||||
QSqlQuery query;
|
QSqlQuery query;
|
||||||
SQL_error_check (query, static_cast<bool (QSqlQuery::*) (QString const&)> (&QSqlQuery::exec),
|
SQL_error_check (query, static_cast<bool (QSqlQuery::*) (QString const&)> (&QSqlQuery::exec),
|
||||||
"CREATE TABLE cabrillo_log ("
|
"CREATE TABLE cabrillo_log_v2 ("
|
||||||
" id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"
|
" id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"
|
||||||
" frequency INTEGER NOT NULL,"
|
" frequency INTEGER NOT NULL,"
|
||||||
" mode VARCHAR(6) NOT NULL,"
|
" mode VARCHAR(6) NOT NULL,"
|
||||||
@ -313,7 +300,7 @@ void CabrilloLog::export_qsos (QTextStream& stream) const
|
|||||||
|
|
||||||
auto CabrilloLog::unique_DXCC_entities (AD1CCty const * countries) const -> worked_set
|
auto CabrilloLog::unique_DXCC_entities (AD1CCty const * countries) const -> worked_set
|
||||||
{
|
{
|
||||||
QSqlQuery q {"SELECT DISTINCT BAND, CALL FROM cabrillo_log"};
|
QSqlQuery q {"SELECT DISTINCT BAND, CALL FROM cabrillo_log_v2"};
|
||||||
auto band_index = q.record ().indexOf ("band");
|
auto band_index = q.record ().indexOf ("band");
|
||||||
auto call_index = q.record ().indexOf ("call");
|
auto call_index = q.record ().indexOf ("call");
|
||||||
worked_set entities;
|
worked_set entities;
|
||||||
|
Loading…
Reference in New Issue
Block a user