Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix #7357
  • Loading branch information
jef-n committed Mar 14, 2013
1 parent e46a67a commit a1b5b92
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/providers/oracle/qgsoracleconn.cpp
Expand Up @@ -194,7 +194,7 @@ bool QgsOracleConn::tableInfo( bool geometryColumnsOnly, bool userTablesOnly, bo
.arg( prefix )
.arg( geometryColumnsOnly ? "sdo_geom_metadata" : "tab_columns" )
.arg( userTablesOnly ? "" : " AND c.owner=t.owner" )
.arg( geometryColumnsOnly ? "" : " WHERE c.data_type='SDO_GEOMETRY' AND c.data_type_owner='MDSYS'" );
.arg( geometryColumnsOnly ? "" : " WHERE c.data_type='SDO_GEOMETRY'" );

if ( allowGeometrylessTables )
{
Expand Down
11 changes: 9 additions & 2 deletions src/providers/oracle/qgsoracleprovider.cpp
Expand Up @@ -1996,21 +1996,28 @@ QgsRectangle QgsOracleProvider::extent()
QString sql;
QSqlQuery qry( *mConnection );

bool ok = false;

if ( !mSpatialIndex.isNull() && ( mUseEstimatedMetadata || mSqlWhereClause.isEmpty() ) )
{
sql = QString( "SELECT SDO_TUNE.EXTENT_OF(%1,%2) FROM dual" )
.arg( quotedValue( QString( "%1.%2" ).arg( mOwnerName ).arg( mTableName ) ) )
.arg( quotedValue( mGeometryColumn ) );

ok = exec( qry, sql );
}
else

if ( !ok )
{
sql = QString( "SELECT SDO_AGGR_MBR(%1) FROM %2" ).arg( quotedIdentifier( mGeometryColumn ) ).arg( mQuery );

if ( !mSqlWhereClause.isEmpty() )
sql += QString( " WHERE %1" ).arg( mSqlWhereClause );

ok = exec( qry, sql );
}

if ( exec( qry, sql ) && qry.next() )
if ( ok && qry.next() )
{
QByteArray *ba = static_cast<QByteArray*>( qry.value( 0 ).data() );
unsigned char *copy = new unsigned char[ba->size()];
Expand Down

0 comments on commit a1b5b92

Please sign in to comment.