Skip to content

Commit 0065497

Browse files
committed
Version 3.8.1
* Removed exception in table validation. Now only printing a warning if table count does not match. This ensures a complete database even if validation finds issues. * Now keeping indexes when finishing DFD database. This avoids the `preparing database` message in Little Navmap when loading the database the first time.
1 parent f56a23d commit 0065497

4 files changed

Lines changed: 35 additions & 13 deletions

File tree

CHANGELOG.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ For example: #3 is https://github.com/albar965/littlenavmap/issues/3.
33

44
===============================================================================
55

6+
# Version 3.8.1
7+
8+
* Removed exception in table validation. Now only printing a warning if table count does not match.
9+
This ensures a complete database even if validation finds issues.
10+
* Now keeping indexes when finishing DFD database. This avoids the `preparing database` message in
11+
Little Navmap when loading the database the first time.
12+
13+
===============================================================================
14+
615
# Version 3.8.0
716

817
* Fixed issue in scenery library loader where airports were wrongly recognized as MSFS POI dummies.

src/atools.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const static QChar SEP(QDir::separator());
3535

3636
QString version()
3737
{
38-
return "3.8.0"; // VERSION_NUMBER - atools
38+
return "3.8.1"; // VERSION_NUMBER - atools
3939
}
4040

4141
QString gitRevision()

src/fs/navdatabase.cpp

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,22 @@ void NavDatabase::create(const QString& codec)
8888
if(options != nullptr)
8989
qDebug() << Q_FUNC_INFO << *options;
9090

91-
createInternal(codec);
91+
bool foundError = false;
92+
createInternal(codec, foundError);
9293
if(aborted)
9394
// Remove all (partial) changes
9495
db->rollback();
9596
else
9697
createDatabaseReportShort();
98+
99+
if(foundError)
100+
{
101+
qWarning() << Qt::endl;
102+
qWarning() << "*****************************************************************************";
103+
qWarning() << "*** Found warnings during basic validation. See log for more information. ***";
104+
qWarning() << "*****************************************************************************";
105+
qWarning() << Qt::endl;
106+
}
97107
}
98108

99109
void NavDatabase::createAirspaceSchema()
@@ -551,7 +561,7 @@ int NavDatabase::countMsSimSteps()
551561
return total;
552562
}
553563

554-
void NavDatabase::createInternal(const QString& sceneryConfigCodec)
564+
void NavDatabase::createInternal(const QString& sceneryConfigCodec, bool& foundError)
555565
{
556566
SceneryCfg sceneryCfg(sceneryConfigCodec);
557567

@@ -837,7 +847,7 @@ void NavDatabase::createInternal(const QString& sceneryConfigCodec)
837847
}
838848

839849
if(options->isBasicValidation())
840-
basicValidation(&progress);
850+
basicValidation(&progress, foundError);
841851

842852
if(options->isDatabaseReport())
843853
{
@@ -1195,29 +1205,32 @@ bool NavDatabase::loadFsxP3dMsfsPost(ProgressHandler *progress)
11951205
return false;
11961206
}
11971207

1198-
bool NavDatabase::basicValidation(ProgressHandler *progress)
1208+
bool NavDatabase::basicValidation(ProgressHandler *progress, bool& foundError)
11991209
{
12001210
if((aborted = progress->reportOther(tr("Basic Validation"))))
12011211
return true;
12021212

12031213
const QMap<QString, int>& basicValidationTables = options->getBasicValidationTables();
12041214
for(auto it = basicValidationTables.begin(); it != basicValidationTables.end(); ++it)
1205-
basicValidateTable(it.key(), it.value());
1215+
basicValidateTable(it.key(), it.value(), foundError);
12061216

12071217
return false;
12081218
}
12091219

1210-
void NavDatabase::basicValidateTable(const QString& table, int minCount)
1220+
void NavDatabase::basicValidateTable(const QString& table, int minCount, bool& foundError)
12111221
{
12121222
SqlUtil util(db);
12131223
if(!util.hasTable(table))
12141224
throw Exception("Table \"" + table + "\" not found.");
12151225

12161226
int count = 0;
12171227
if((count = util.rowCount(table)) < minCount)
1218-
throw Exception(QString("Table \"%1\" has only %2 rows. Minimum required is %3").arg(table).arg(count).arg(minCount));
1219-
1220-
qInfo() << "Table" << table << "is OK. Has" << count << "rows. Minimum required is" << minCount;
1228+
{
1229+
qWarning() << "*** Table" << table << "has only" << count << "rows. Minimum required is" << minCount << "***";
1230+
foundError = true;
1231+
}
1232+
else
1233+
qInfo() << "Table" << table << "is OK. Has" << count << "rows. Minimum required is" << minCount;
12211234
}
12221235

12231236
void NavDatabase::runPreparationPost245(atools::sql::SqlDatabase& db)

src/fs/navdatabase.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class NavDatabase
126126
void createSchemaInternal(atools::fs::ProgressHandler *progress = nullptr);
127127

128128
/* Internal creation of the full database */
129-
void createInternal(const QString& sceneryConfigCodec);
129+
void createInternal(const QString& sceneryConfigCodec, bool& foundError);
130130

131131
/* Read FSX/P3D scenery configuration */
132132
void readSceneryConfigFsxP3d(atools::fs::scenery::SceneryCfg& cfg);
@@ -163,8 +163,8 @@ class NavDatabase
163163
/* Print row counts to log file */
164164
void createDatabaseReportShort();
165165

166-
bool basicValidation(ProgressHandler *progress);
167-
void basicValidateTable(const QString& table, int minCount);
166+
bool basicValidation(ProgressHandler *progress, bool& foundError);
167+
void basicValidateTable(const QString& table, int minCount, bool& foundError);
168168
void reportCoordinateViolations(QDebug& out, atools::sql::SqlUtil& util, const QStringList& tables);
169169

170170
/* Count files in FSX/P3D scenery configuration */

0 commit comments

Comments
 (0)