本文整理汇总了C++中OGRDataSource::Dereference方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRDataSource::Dereference方法的具体用法?C++ OGRDataSource::Dereference怎么用?C++ OGRDataSource::Dereference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRDataSource
的用法示例。
在下文中一共展示了OGRDataSource::Dereference方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
JNIEXPORT jint JNICALL Java_es_gva_cit_jogr_JNIBase_dereferenceNat
(JNIEnv *env, jobject obj, jlong cPtr){
OGRDataSource *ds = (OGRDataSource *) 0 ;
int res=-1;
ds = *(OGRDataSource **)&cPtr;
if(ds!=NULL){
res = ds->Dereference();
}
return res;
}
示例2: if
OGRLayer * OGRDataSource::ExecuteSQL( const char *pszStatement,
OGRGeometry *poSpatialFilter,
const char *pszDialect )
{
const char *pszError;
swq_select *psSelectInfo = NULL;
(void) pszDialect;
/* -------------------------------------------------------------------- */
/* Handle CREATE INDEX statements specially. */
/* -------------------------------------------------------------------- */
if( EQUALN(pszStatement,"CREATE INDEX",12) )
{
ProcessSQLCreateIndex( pszStatement );
return NULL;
}
/* -------------------------------------------------------------------- */
/* Handle DROP INDEX statements specially. */
/* -------------------------------------------------------------------- */
if( EQUALN(pszStatement,"DROP INDEX",10) )
{
ProcessSQLDropIndex( pszStatement );
return NULL;
}
/* -------------------------------------------------------------------- */
/* Preparse the SQL statement. */
/* -------------------------------------------------------------------- */
pszError = swq_select_preparse( pszStatement, &psSelectInfo );
if( pszError != NULL )
{
CPLError( CE_Failure, CPLE_AppDefined,
"SQL: %s", pszError );
return NULL;
}
/* -------------------------------------------------------------------- */
/* Validate that all the source tables are recognised, count */
/* fields. */
/* -------------------------------------------------------------------- */
int nFieldCount = 0, iTable;
for( iTable = 0; iTable < psSelectInfo->table_count; iTable++ )
{
swq_table_def *psTableDef = psSelectInfo->table_defs + iTable;
OGRLayer *poSrcLayer;
OGRDataSource *poTableDS = this;
if( psTableDef->data_source != NULL )
{
poTableDS = (OGRDataSource *)
OGROpenShared( psTableDef->data_source, FALSE, NULL );
if( poTableDS == NULL )
{
if( strlen(CPLGetLastErrorMsg()) == 0 )
CPLError( CE_Failure, CPLE_AppDefined,
"Unable to open secondary datasource\n"
"`%s' required by JOIN.",
psTableDef->data_source );
swq_select_free( psSelectInfo );
return NULL;
}
// This drops explicit reference, but leave it open for use by
// code in ogr_gensql.cpp
poTableDS->Dereference();
}
poSrcLayer = poTableDS->GetLayerByName( psTableDef->table_name );
if( poSrcLayer == NULL )
{
CPLError( CE_Failure, CPLE_AppDefined,
"SELECT from table %s failed, no such table/featureclass.",
psTableDef->table_name );
swq_select_free( psSelectInfo );
return NULL;
}
nFieldCount += poSrcLayer->GetLayerDefn()->GetFieldCount();
}
/* -------------------------------------------------------------------- */
/* Build the field list for all indicated tables. */
/* -------------------------------------------------------------------- */
swq_field_list sFieldList;
int nFIDIndex = 0;
memset( &sFieldList, 0, sizeof(sFieldList) );
sFieldList.table_count = psSelectInfo->table_count;
sFieldList.table_defs = psSelectInfo->table_defs;
sFieldList.count = 0;
sFieldList.names = (char **) CPLMalloc( sizeof(char *) * (nFieldCount+1) );
sFieldList.types = (swq_field_type *)
CPLMalloc( sizeof(swq_field_type) * (nFieldCount+1) );
//.........这里部分代码省略.........
示例3: if
//.........这里部分代码省略.........
goto end;
}
nFieldCount += poSrcLayer->GetLayerDefn()->GetFieldCount();
}
/* -------------------------------------------------------------------- */
/* Build the field list for all indicated tables. */
/* -------------------------------------------------------------------- */
sFieldList.table_count = psSelectInfo->table_count;
sFieldList.table_defs = psSelectInfo->table_defs;
sFieldList.count = 0;
sFieldList.names = (char **) CPLMalloc( sizeof(char *) * (nFieldCount+SPECIAL_FIELD_COUNT) );
sFieldList.types = (swq_field_type *)
CPLMalloc( sizeof(swq_field_type) * (nFieldCount+SPECIAL_FIELD_COUNT) );
sFieldList.table_ids = (int *)
CPLMalloc( sizeof(int) * (nFieldCount+SPECIAL_FIELD_COUNT) );
sFieldList.ids = (int *)
CPLMalloc( sizeof(int) * (nFieldCount+SPECIAL_FIELD_COUNT) );
for( iTable = 0; iTable < psSelectInfo->table_count; iTable++ )
{
swq_table_def *psTableDef = psSelectInfo->table_defs + iTable;
OGRDataSource *poTableDS = this;
OGRLayer *poSrcLayer;
if( psTableDef->data_source != NULL )
{
poTableDS = (OGRDataSource *)
OGROpenShared( psTableDef->data_source, FALSE, NULL );
CPLAssert( poTableDS != NULL );
poTableDS->Dereference();
}
poSrcLayer = poTableDS->GetLayerByName( psTableDef->table_name );
for( iField = 0;
iField < poSrcLayer->GetLayerDefn()->GetFieldCount();
iField++ )
{
OGRFieldDefn *poFDefn=poSrcLayer->GetLayerDefn()->GetFieldDefn(iField);
int iOutField = sFieldList.count++;
sFieldList.names[iOutField] = (char *) poFDefn->GetNameRef();
if( poFDefn->GetType() == OFTInteger )
sFieldList.types[iOutField] = SWQ_INTEGER;
else if( poFDefn->GetType() == OFTReal )
sFieldList.types[iOutField] = SWQ_FLOAT;
else if( poFDefn->GetType() == OFTString )
sFieldList.types[iOutField] = SWQ_STRING;
else
sFieldList.types[iOutField] = SWQ_OTHER;
sFieldList.table_ids[iOutField] = iTable;
sFieldList.ids[iOutField] = iField;
}
if( iTable == 0 )
nFIDIndex = poSrcLayer->GetLayerDefn()->GetFieldCount();
}
/* -------------------------------------------------------------------- */
/* Expand '*' in 'SELECT *' now before we add the pseudo fields */
/* -------------------------------------------------------------------- */
pszError =