本文整理汇总了C++中CPLODBCStatement::GetCommand方法的典型用法代码示例。如果您正苦于以下问题:C++ CPLODBCStatement::GetCommand方法的具体用法?C++ CPLODBCStatement::GetCommand怎么用?C++ CPLODBCStatement::GetCommand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPLODBCStatement
的用法示例。
在下文中一共展示了CPLODBCStatement::GetCommand方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildStatement
CPLODBCStatement* OGRMSSQLSpatialTableLayer::BuildStatement(const char* pszColumns)
{
CPLODBCStatement* poStatement = new CPLODBCStatement( poDS->GetSession() );
poStatement->Append( "select " );
poStatement->Append( pszColumns );
poStatement->Append( " from " );
poStatement->Append( pszSchemaName );
poStatement->Append( "." );
poStatement->Append( pszTableName );
/* Append attribute query if we have it */
if( pszQuery != NULL )
poStatement->Appendf( " where (%s)", pszQuery );
/* If we have a spatial filter, query on it */
if ( m_poFilterGeom != NULL )
{
if (nGeomColumnType == MSSQLCOLTYPE_GEOMETRY
|| nGeomColumnType == MSSQLCOLTYPE_GEOGRAPHY)
{
if( pszQuery == NULL )
poStatement->Append( " where" );
else
poStatement->Append( " and" );
poStatement->Appendf(" [%s].STIntersects(", pszGeomColumn );
if (nGeomColumnType == MSSQLCOLTYPE_GEOGRAPHY)
poStatement->Append( "geography::" );
else
poStatement->Append( "geometry::" );
if ( m_sFilterEnvelope.MinX == m_sFilterEnvelope.MaxX ||
m_sFilterEnvelope.MinY == m_sFilterEnvelope.MaxY)
poStatement->Appendf("STGeomFromText('POINT(%.15g %.15g)',%d)) = 1",
m_sFilterEnvelope.MinX, m_sFilterEnvelope.MinY, nSRSId >= 0? nSRSId : 0);
else
poStatement->Appendf( "STGeomFromText('POLYGON((%.15g %.15g,%.15g %.15g,%.15g %.15g,%.15g %.15g,%.15g %.15g))',%d)) = 1",
m_sFilterEnvelope.MinX, m_sFilterEnvelope.MinY,
m_sFilterEnvelope.MaxX, m_sFilterEnvelope.MinY,
m_sFilterEnvelope.MaxX, m_sFilterEnvelope.MaxY,
m_sFilterEnvelope.MinX, m_sFilterEnvelope.MaxY,
m_sFilterEnvelope.MinX, m_sFilterEnvelope.MinY,
nSRSId >= 0? nSRSId : 0 );
}
else
{
CPLError( CE_Failure, CPLE_AppDefined,
"Spatial filter is supported only on geometry and geography column types." );
delete poStatement;
return NULL;
}
}
CPLDebug( "OGR_MSSQLSpatial", "ExecuteSQL(%s)", poStatement->GetCommand() );
if( poStatement->ExecuteSQL() )
return poStatement;
else
{
delete poStatement;
return NULL;
}
}