@@ -2217,7 +2217,7 @@ void OGRGeoPackageTableLayer::CheckGeometryType(const OGRFeature *poFeature)
2217
2217
static bool CheckFIDAndFIDColumnConsistency (const OGRFeature *poFeature,
2218
2218
int iFIDAsRegularColumnIndex)
2219
2219
{
2220
- bool ok = false ;
2220
+ bool ok = true ;
2221
2221
if (!poFeature->IsFieldSetAndNotNull (iFIDAsRegularColumnIndex))
2222
2222
{
2223
2223
// nothing to do
@@ -2231,21 +2231,26 @@ static bool CheckFIDAndFIDColumnConsistency(const OGRFeature *poFeature,
2231
2231
if (GDALIsValueInRange<int64_t >(dfFID))
2232
2232
{
2233
2233
const auto nFID = static_cast <GIntBig>(dfFID);
2234
- if (nFID = = poFeature->GetFID ())
2234
+ if (nFID ! = poFeature->GetFID ())
2235
2235
{
2236
- ok = true ;
2236
+ ok = false ;
2237
+ CPLError (CE_Failure, CPLE_AppDefined,
2238
+ " Inconsistent values of FID (" CPL_FRMT_GIB
2239
+ " ) and field of same name (%g)" ,
2240
+ poFeature->GetFID (),
2241
+ poFeature->GetFieldAsDouble (iFIDAsRegularColumnIndex));
2237
2242
}
2238
2243
}
2239
2244
}
2240
- else if (poFeature->GetFieldAsInteger64 (iFIDAsRegularColumnIndex) = =
2245
+ else if (poFeature->GetFieldAsInteger64 (iFIDAsRegularColumnIndex) ! =
2241
2246
poFeature->GetFID ())
2242
2247
{
2243
- ok = true ;
2244
- }
2245
- if (!ok)
2246
- {
2248
+ ok = false ;
2247
2249
CPLError (CE_Failure, CPLE_AppDefined,
2248
- " Inconsistent values of FID and field of same name" );
2250
+ " Inconsistent values of FID (" CPL_FRMT_GIB
2251
+ " ) and field of same name (" CPL_FRMT_GIB " )" ,
2252
+ poFeature->GetFID (),
2253
+ poFeature->GetFieldAsInteger64 (iFIDAsRegularColumnIndex));
2249
2254
}
2250
2255
return ok;
2251
2256
}
0 commit comments