Skip to content

Commit

Permalink
VDV: make driver not report OLCRandomWrite on IDF datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Jan 26, 2025
1 parent bf65ab9 commit c056f7d
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions frmts/pds/pdsdrivercore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ void PDS4DriverSetCommonMetadata(GDALDriver *poDriver)
poDriver->SetMetadataItem(GDAL_DCAP_OPEN, "YES");
poDriver->SetMetadataItem(GDAL_DCAP_CREATE, "YES");
poDriver->SetMetadataItem(GDAL_DCAP_CREATECOPY, "YES");

poDriver->SetMetadataItem(GDAL_DCAP_UPDATE, "YES");
poDriver->SetMetadataItem(GDAL_DMD_UPDATE_ITEMS, "Features");
}

/************************************************************************/
Expand Down
3 changes: 3 additions & 0 deletions ogr/ogrsf_frmts/mem/ogr_mem.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ class OGRMemDataSource CPL_NON_FINAL : public GDALDataset

int TestCapability(const char *) override;

OGRLayer *ExecuteSQL(const char *pszStatement, OGRGeometry *poSpatialFilter,
const char *pszDialect) override;

bool AddFieldDomain(std::unique_ptr<OGRFieldDomain> &&domain,
std::string &failureReason) override;

Expand Down
17 changes: 17 additions & 0 deletions ogr/ogrsf_frmts/mem/ogrmemdatasource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,20 @@ bool OGRMemDataSource::UpdateFieldDomain(
m_oMapFieldDomains[domainName] = std::move(domain);
return true;
}

/************************************************************************/
/* ExecuteSQL() */
/************************************************************************/

OGRLayer *OGRMemDataSource::ExecuteSQL(const char *pszStatement,
OGRGeometry *poSpatialFilter,
const char *pszDialect)
{
if (EQUAL(pszStatement, "PRAGMA read_only=1")) // as used by VDV driver
{
for (int i = 0; i < nLayers; ++i)
papoLayers[i]->SetUpdatable(false);
return nullptr;
}
return GDALDataset::ExecuteSQL(pszStatement, poSpatialFilter, pszDialect);
}
3 changes: 3 additions & 0 deletions ogr/ogrsf_frmts/mongodbv3/ogrmongodbv3drivercore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ void OGRMongoDBv3DriverSetCommonMetadata(GDALDriver *poDriver)

poDriver->pfnIdentify = OGRMongoDBv3DriverIdentify;
poDriver->SetMetadataItem(GDAL_DCAP_OPEN, "YES");

poDriver->SetMetadataItem(GDAL_DCAP_UPDATE, "YES");
poDriver->SetMetadataItem(GDAL_DMD_UPDATE_ITEMS, "Features");
}

/************************************************************************/
Expand Down
3 changes: 3 additions & 0 deletions ogr/ogrsf_frmts/ods/ogrodsdriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ void RegisterOGRODS()
poDriver->SetMetadataItem(GDAL_DMD_ALTER_FIELD_DEFN_FLAGS, "Name Type");
poDriver->SetMetadataItem(GDAL_DMD_SUPPORTED_SQL_DIALECTS, "OGRSQL SQLITE");

poDriver->SetMetadataItem(GDAL_DCAP_UPDATE, "YES");
poDriver->SetMetadataItem(GDAL_DMD_UPDATE_ITEMS, "Features");

poDriver->SetMetadataItem(
GDAL_DMD_OPENOPTIONLIST,
"<OpenOptionList>"
Expand Down
5 changes: 5 additions & 0 deletions ogr/ogrsf_frmts/vdv/ogrvdvdatasource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,10 @@ void OGRIDFDataSource::Parse()
}
}

bool bIsMEMLayer = false;
if (m_poTmpDS == nullptr)
{
bIsMEMLayer = true;
m_poTmpDS = poMEMDriver->Create("", 0, 0, 0, GDT_Unknown, nullptr);
}

Expand Down Expand Up @@ -583,6 +585,9 @@ void OGRIDFDataSource::Parse()

m_poTmpDS->CommitTransaction();

if (bIsMEMLayer)
m_poTmpDS->ExecuteSQL("PRAGMA read_only=1", nullptr, nullptr);

std::map<GIntBig, OGRLineString *>::iterator oMapLinkCoordinateIter =
oMapLinkCoordinate.begin();
for (; oMapLinkCoordinateIter != oMapLinkCoordinate.end();
Expand Down
3 changes: 3 additions & 0 deletions ogr/ogrsf_frmts/xlsx/ogrxlsxdriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ void RegisterOGRXLSX()
poDriver->SetMetadataItem(GDAL_DCAP_Z_GEOMETRIES, "YES");
poDriver->SetMetadataItem(GDAL_DMD_SUPPORTED_SQL_DIALECTS, "OGRSQL SQLITE");

poDriver->SetMetadataItem(GDAL_DCAP_UPDATE, "YES");
poDriver->SetMetadataItem(GDAL_DMD_UPDATE_ITEMS, "Features");

poDriver->SetMetadataItem(
GDAL_DMD_OPENOPTIONLIST,
"<OpenOptionList>"
Expand Down

0 comments on commit c056f7d

Please sign in to comment.