Changeset 13808
- Timestamp:
- 02/17/08 11:29:35 (3 months ago)
- Files:
-
- trunk/gdal/ogr/ogrsf_frmts/vrt/drv_vrt.html (modified) (1 diff)
- trunk/gdal/ogr/ogrsf_frmts/vrt/ogr_vrt.h (modified) (1 diff)
- trunk/gdal/ogr/ogrsf_frmts/vrt/ogrvrtlayer.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/gdal/ogr/ogrsf_frmts/vrt/drv_vrt.html
r13708 r13808 35 35 a <b>relativeToVRT</b> attribute which defaults to "0", but if "1" indicates 36 36 that the source datasource should be interpreted as relative to the virtual 37 file. This can be any OGR supported dataset, including ODBC, CSV, etc.<p> 37 file. This can be any OGR supported dataset, including ODBC, CSV, etc. 38 The element may also have a <b>shared</b> attribute to control whether the datasource should be opened in shared mode. Defaults to OFF for SrcLayer use and ON for SrcSQL use.<p> 38 39 39 40 <li> <b>SrcLayer</b> (optional): The value is the name of the layer on the trunk/gdal/ogr/ogrsf_frmts/vrt/ogr_vrt.h
r10645 r13808 57 57 int bNeedReset; 58 58 int bSrcLayerFromSQL; 59 int bSrcDSShared; 59 60 60 61 // Layer spatial reference system, and srid. trunk/gdal/ogr/ogrsf_frmts/vrt/ogrvrtlayer.cpp
r13755 r13808 105 105 poSrcDS->ReleaseResultSet( poSrcLayer ); 106 106 107 OGRSFDriverRegistrar::GetRegistrar()->ReleaseDataSource( poSrcDS ); 107 if( bSrcDSShared ) 108 OGRSFDriverRegistrar::GetRegistrar()->ReleaseDataSource( poSrcDS ); 109 else 110 delete poSrcDS; 108 111 } 109 112 … … 171 174 172 175 /* -------------------------------------------------------------------- */ 176 /* Are we accessing this datasource in shared mode? We default */ 177 /* to shared for SrcSQL requests, but we also allow the XML to */ 178 /* control our shared setting with an attribute on the */ 179 /* datasource element. */ 180 /* -------------------------------------------------------------------- */ 181 const char *pszSharedSetting = CPLGetXMLValue( psLTree, 182 "SrcDataSource.shared", 183 NULL ); 184 if( pszSharedSetting == NULL ) 185 { 186 if( CPLGetXMLValue( psLTree, "SrcSQL", NULL ) == NULL ) 187 pszSharedSetting = "OFF"; 188 else 189 pszSharedSetting = "ON"; 190 } 191 192 bSrcDSShared = CSLTestBoolean( pszSharedSetting ); 193 194 /* -------------------------------------------------------------------- */ 173 195 /* Try to access the datasource. */ 174 196 /* -------------------------------------------------------------------- */ 175 197 CPLErrorReset(); 176 poSrcDS = poReg->OpenShared( pszSrcDSName, FALSE, NULL ); 198 if( bSrcDSShared ) 199 poSrcDS = poReg->OpenShared( pszSrcDSName, FALSE, NULL ); 200 else 201 poSrcDS = poReg->Open( pszSrcDSName, FALSE, NULL ); 177 202 178 203 if( poSrcDS == NULL )
