Skip to content

Commit 991f94d

Browse files
committedNov 3, 2014
oracle provider:
* if a no spatial index is found try sdo_filter (fixes #11358) * allow specifing connection parameters (eg. OCI_ATTR_PREFETCH_ROWS=10000)
1 parent d546de1 commit 991f94d

13 files changed

+134
-109
lines changed
 

‎src/gui/qgsmanageconnectionsdialog.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ QDomDocument QgsManageConnectionsDialog::saveOracleConnections( const QStringLis
494494
el.setAttribute( "host", settings.value( path + "/host", "" ).toString() );
495495
el.setAttribute( "port", settings.value( path + "/port", "" ).toString() );
496496
el.setAttribute( "database", settings.value( path + "/database", "" ).toString() );
497+
el.setAttribute( "dboptions", settings.value( path + "/dboptions", "" ).toString() );
497498
el.setAttribute( "estimatedMetadata", settings.value( path + "/estimatedMetadata", "0" ).toString() );
498499
el.setAttribute( "userTablesOnly", settings.value( path + "/userTablesOnly", "0" ).toString() );
499500
el.setAttribute( "geometryColumnsOnly", settings.value( path + "/geometryColumnsOnly", "0" ).toString() );
@@ -937,6 +938,7 @@ void QgsManageConnectionsDialog::loadOracleConnections( const QDomDocument &doc,
937938
settings.setValue( "/host", child.attribute( "host" ) );
938939
settings.setValue( "/port", child.attribute( "port" ) );
939940
settings.setValue( "/database", child.attribute( "database" ) );
941+
settings.setValue( "/dboptions", child.attribute( "dboptions" ) );
940942
settings.setValue( "/estimatedMetadata", child.attribute( "estimatedMetadata" ) );
941943
settings.setValue( "/userTablesOnly", child.attribute( "userTablesOnly" ) );
942944
settings.setValue( "/geometryColumnsOnly", child.attribute( "geometryColumnsOnly" ) );

‎src/providers/oracle/qgsoraclecolumntypethread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void QgsOracleColumnTypeThread::run()
4040
mStopped = false;
4141

4242
QgsDataSourceURI uri = QgsOracleConn::connUri( mName );
43-
QgsOracleConn *conn = QgsOracleConn::connectDb( uri.connectionInfo() );
43+
QgsOracleConn *conn = QgsOracleConn::connectDb( uri );
4444
if ( !conn )
4545
{
4646
QgsDebugMsg( "Connection failed - " + uri.connectionInfo() );

‎src/providers/oracle/qgsoracleconn.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,13 @@ QgsOracleConn::QgsOracleConn( QgsDataSourceURI uri )
6767

6868
mDatabase = QSqlDatabase::addDatabase( "QOCISPATIAL", QString( "oracle%1" ).arg( snConnections++ ) );
6969
mDatabase.setDatabaseName( database );
70-
mDatabase.setConnectOptions( "OCI_ATTR_PREFETCH_ROWS=1000" );
70+
QString options = uri.hasParam( "dboptions" ) ? uri.param( "dboptions" ) : "OCI_ATTR_PREFETCH_ROWS=1000";
71+
mDatabase.setConnectOptions( options );
7172
mDatabase.setUserName( uri.username() );
7273
mDatabase.setPassword( uri.password() );
7374

75+
QgsDebugMsg( QString( "Connecting with options: " ) + options );
76+
7477
if ( !mDatabase.open() )
7578
{
7679
QString username = uri.username();
@@ -706,6 +709,10 @@ QgsDataSourceURI QgsOracleConn::connUri( QString theConnName )
706709
QgsDataSourceURI uri;
707710
uri.setConnection( host, port, database, username, password );
708711
uri.setUseEstimatedMetadata( useEstimatedMetadata );
712+
if ( !settings.value( key + "/dboptions" ).toString().isEmpty() )
713+
{
714+
uri.setParam( "dboptions", settings.value( key + "/dboptions" ).toString() );
715+
}
709716

710717
return uri;
711718
}

‎src/providers/oracle/qgsoraclefeatureiterator.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ QgsOracleFeatureIterator::QgsOracleFeatureIterator( QgsOracleFeatureSource* sour
5252
break;
5353

5454
case QgsFeatureRequest::FilterRect:
55-
if ( !mSource->mGeometryColumn.isNull() )
55+
if ( !mSource->mGeometryColumn.isNull() && mSource->mHasSpatialIndex )
5656
{
5757
QgsRectangle rect( mRequest.filterRect() );
5858
QString bbox = QString( "mdsys.sdo_geometry(2003,%1,NULL,"
@@ -65,18 +65,15 @@ QgsOracleFeatureIterator::QgsOracleFeatureIterator( QgsOracleFeatureSource* sour
6565
.arg( qgsDoubleToString( rect.xMaximum() ) )
6666
.arg( qgsDoubleToString( rect.yMaximum() ) );
6767

68-
if ( !mSource->mSpatialIndex.isNull() )
69-
{
70-
whereClause = QString( "sdo_filter(%1,%2)='TRUE'" ).arg( QgsOracleProvider::quotedIdentifier( mSource->mGeometryColumn ) ).arg( bbox );
68+
whereClause = QString( "sdo_filter(%1,%2)='TRUE'" ).arg( QgsOracleProvider::quotedIdentifier( mSource->mGeometryColumn ) ).arg( bbox );
7169
#if 0
72-
if ( mRequest.flags() & QgsFeatureRequest::ExactIntersect )
73-
{
74-
whereClause += QString( " AND sdo_relate(%1,%2,'mask=ANYINTERACT')='TRUE'" )
75-
.arg( quotedIdentifier( P->mGeometryColumn ) )
76-
.arg( bbox );
77-
}
78-
#endif
70+
if ( mRequest.flags() & QgsFeatureRequest::ExactIntersect )
71+
{
72+
whereClause += QString( " AND sdo_relate(%1,%2,'mask=ANYINTERACT')='TRUE'" )
73+
.arg( quotedIdentifier( P->mGeometryColumn ) )
74+
.arg( bbox );
7975
}
76+
#endif
8077
}
8178
break;
8279

@@ -344,7 +341,7 @@ QgsOracleFeatureSource::QgsOracleFeatureSource( const QgsOracleProvider* p )
344341
, mFields( p->mAttributeFields )
345342
, mGeometryColumn( p->mGeometryColumn )
346343
, mSrid( p->mSrid )
347-
, mSpatialIndex( p->mSpatialIndex )
344+
, mHasSpatialIndex( p->mHasSpatialIndex )
348345
, mDetectedGeomType( p->mDetectedGeomType )
349346
, mRequestedGeomType( p->mRequestedGeomType )
350347
, mSqlWhereClause( p->mSqlWhereClause )

‎src/providers/oracle/qgsoraclefeatureiterator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class QgsOracleFeatureSource : public QgsAbstractFeatureSource
4141

4242
QString mGeometryColumn; //! name of the geometry column
4343
int mSrid; //! srid of column
44-
QString mSpatialIndex; //! name of spatial index of geometry column
44+
bool mHasSpatialIndex; //! has spatial index of geometry column
4545
QGis::WkbType mDetectedGeomType; //! geometry type detected in the database
4646
QGis::WkbType mRequestedGeomType; //! geometry type requested in the uri
4747
QString mSqlWhereClause;

‎src/providers/oracle/qgsoraclenewconnection.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ QgsOracleNewConnection::QgsOracleNewConnection( QWidget *parent, const QString&
4444
port = "1521";
4545
}
4646
txtPort->setText( port );
47+
txtOptions->setText( settings.value( key + "/dboptions" ).toString() );
4748
cb_userTablesOnly->setChecked( settings.value( key + "/userTablesOnly", false ).toBool() );
4849
cb_geometryColumnsOnly->setChecked( settings.value( key + "/geometryColumnsOnly", true ).toBool() );
4950
cb_allowGeometrylessTables->setChecked( settings.value( key + "/allowGeometrylessTables", false ).toBool() );
@@ -125,6 +126,7 @@ void QgsOracleNewConnection::accept()
125126
settings.setValue( baseKey + "/onlyExistingTypes", cb_onlyExistingTypes->isChecked() ? "true" : "false" );
126127
settings.setValue( baseKey + "/saveUsername", chkStoreUsername->isChecked() ? "true" : "false" );
127128
settings.setValue( baseKey + "/savePassword", chkStorePassword->isChecked() ? "true" : "false" );
129+
settings.setValue( baseKey + "/dboptions", txtOptions->text() );
128130

129131
// remove old save setting
130132
settings.remove( baseKey + "/save" );
@@ -136,6 +138,8 @@ void QgsOracleNewConnection::on_btnConnect_clicked()
136138
{
137139
QgsDataSourceURI uri;
138140
uri.setConnection( txtHost->text(), txtPort->text(), txtDatabase->text(), txtUsername->text(), txtPassword->text() );
141+
if ( !txtOptions->text().isEmpty() )
142+
uri.setParam( "dboptions", txtOptions->text() );
139143

140144
QgsOracleConn *conn = QgsOracleConn::connectDb( uri );
141145

‎src/providers/oracle/qgsoracleprovider.cpp

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ QgsOracleProvider::QgsOracleProvider( QString const & uri )
4848
, mPrimaryKeyType( pktUnknown )
4949
, mDetectedGeomType( QGis::WKBUnknown )
5050
, mRequestedGeomType( QGis::WKBUnknown )
51-
, mSpatialIndex( QString::null )
51+
, mHasSpatialIndex( false )
52+
, mSpatialIndexName( QString::null )
5253
, mShared( new QgsOracleSharedData )
5354
{
5455
static int geomMetaType = -1;
@@ -68,7 +69,7 @@ QgsOracleProvider::QgsOracleProvider( QString const & uri )
6869
mRequestedGeomType = mUri.wkbType();
6970
mUseEstimatedMetadata = mUri.useEstimatedMetadata();
7071

71-
mConnection = QgsOracleConn::connectDb( mUri.connectionInfo() );
72+
mConnection = QgsOracleConn::connectDb( mUri );
7273
if ( !mConnection )
7374
{
7475
return;
@@ -664,30 +665,22 @@ bool QgsOracleProvider::loadFields()
664665
{
665666
if ( qry.next() )
666667
{
667-
mSpatialIndex = qry.value( 0 ).toString();
668+
mSpatialIndexName = qry.value( 0 ).toString();
668669
if ( qry.value( 1 ).toString() != "VALID" )
669670
{
670671
QgsMessageLog::logMessage( tr( "Invalid spatial index %1 on column %2.%3.%4 found - expect poor performance." )
671-
.arg( mSpatialIndex )
672+
.arg( mSpatialIndexName )
672673
.arg( mOwnerName )
673674
.arg( mTableName )
674675
.arg( mGeometryColumn ),
675676
tr( "Oracle" ) );
676-
mSpatialIndex = QString::null;
677677
}
678678
else
679679
{
680-
QgsDebugMsg( QString( "Valid spatial index %1 found" ).arg( mSpatialIndex ) );
680+
QgsDebugMsg( QString( "Valid spatial index %1 found" ).arg( mSpatialIndexName ) );
681+
mHasSpatialIndex = true;
681682
}
682683
}
683-
else
684-
{
685-
QgsMessageLog::logMessage( tr( "No spatial index on column %1.%2.%3 found - expect poor performance." )
686-
.arg( mOwnerName )
687-
.arg( mTableName )
688-
.arg( mGeometryColumn ),
689-
tr( "Oracle" ) );
690-
}
691684
}
692685
else
693686
{
@@ -698,6 +691,21 @@ bool QgsOracleProvider::loadFields()
698691
.arg( qry.lastError().text() ),
699692
tr( "Oracle" ) );
700693
}
694+
695+
if ( !mHasSpatialIndex )
696+
{
697+
mHasSpatialIndex = qry.exec( QString( "SELECT %2 FROM %1 WHERE sdo_filter(%2,mdsys.sdo_geometry(2003,NULL,NULL,mdsys.sdo_elem_info_array(1,1003,3),mdsys.sdo_ordinate_array(1,1,-1,-1)))='TRUE'" )
698+
.arg( mQuery )
699+
.arg( quotedIdentifier( mGeometryColumn ) ) );
700+
if ( !mHasSpatialIndex )
701+
{
702+
QgsMessageLog::logMessage( tr( "No spatial index on column %1.%2.%3 found - expect poor performance." )
703+
.arg( mOwnerName )
704+
.arg( mTableName )
705+
.arg( mGeometryColumn ),
706+
tr( "Oracle" ) );
707+
}
708+
}
701709
}
702710

703711
qry.finish();
@@ -2006,7 +2014,7 @@ QgsRectangle QgsOracleProvider::extent()
20062014

20072015
bool ok = false;
20082016

2009-
if ( !mSpatialIndex.isNull() && ( mUseEstimatedMetadata || mSqlWhereClause.isEmpty() ) )
2017+
if ( mHasSpatialIndex && ( mUseEstimatedMetadata || mSqlWhereClause.isEmpty() ) )
20102018
{
20112019
sql = QString( "SELECT SDO_TUNE.EXTENT_OF(%1,%2) FROM dual" )
20122020
.arg( quotedValue( QString( "%1.%2" ).arg( mOwnerName ).arg( mTableName ) ) )
@@ -2080,7 +2088,7 @@ bool QgsOracleProvider::getGeometryDetails()
20802088

20812089
int detectedSrid = -1;
20822090
QGis::WkbType detectedType = QGis::WKBUnknown;
2083-
mSpatialIndex = QString::null;
2091+
mHasSpatialIndex = false;
20842092

20852093
if ( mIsQuery )
20862094
{
@@ -2289,7 +2297,7 @@ bool QgsOracleProvider::createSpatialIndex()
22892297
QgsDebugMsg( "geographic CRS" );
22902298
}
22912299

2292-
if ( mSpatialIndex.isNull() )
2300+
if ( !mHasSpatialIndex )
22932301
{
22942302
int n = 0;
22952303
if ( exec( qry, QString( "SELECT coalesce(substr(max(index_name),10),'0') FROM all_indexes WHERE index_name LIKE 'QGIS_IDX_%' ESCAPE '#' ORDER BY index_name" ) ) &&
@@ -2311,11 +2319,11 @@ bool QgsOracleProvider::createSpatialIndex()
23112319
return false;
23122320
}
23132321

2314-
mSpatialIndex = QString( "QGIS_IDX_%1" ).arg( n, 10, 10, QChar( '0' ) );
2322+
mSpatialIndexName = QString( "QGIS_IDX_%1" ).arg( n, 10, 10, QChar( '0' ) );
23152323
}
23162324
else
23172325
{
2318-
if ( !exec( qry, QString( "ALTER INDEX %1 REBUILD" ).arg( mSpatialIndex ) ) )
2326+
if ( !exec( qry, QString( "ALTER INDEX %1 REBUILD" ).arg( mSpatialIndexName ) ) )
23192327
{
23202328
QgsMessageLog::logMessage( tr( "Rebuild of spatial index failed.\nSQL:%1\nError: %2" )
23212329
.arg( qry.lastQuery() )
@@ -2402,7 +2410,7 @@ QgsVectorLayerImport::ImportError QgsOracleProvider::createEmptyLayer(
24022410
QgsDebugMsg( QString( "Connection info is: %1" ).arg( dsUri.connectionInfo() ) );
24032411

24042412
// create the table
2405-
QgsOracleConn *conn = QgsOracleConn::connectDb( dsUri.connectionInfo() );
2413+
QgsOracleConn *conn = QgsOracleConn::connectDb( dsUri );
24062414
if ( !conn )
24072415
{
24082416
if ( errorMessage )
@@ -2891,7 +2899,7 @@ QGISEXTERN bool deleteLayer( const QString& uri, QString& errCause )
28912899
QString tableName = dsUri.table();
28922900
QString geometryCol = dsUri.geometryColumn();
28932901

2894-
QgsOracleConn* conn = QgsOracleConn::connectDb( dsUri.connectionInfo() );
2902+
QgsOracleConn* conn = QgsOracleConn::connectDb( dsUri );
28952903
if ( !conn )
28962904
{
28972905
errCause = QObject::tr( "Connection to database failed" );

‎src/providers/oracle/qgsoracleprovider.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,9 @@ class QgsOracleProvider : public QgsVectorDataProvider
397397
QgsFeatureId mFidCounter; //! next feature id if map is used
398398
QgsOracleConn *mConnection;
399399

400-
QString mSpatialIndex; //! name of spatial index of geometry column
401400
bool mHasSpatial; //! Oracle Spatial is installed
401+
bool mHasSpatialIndex; //! Geometry column is indexed
402+
QString mSpatialIndexName; //! name of spatial index of geometry column
402403

403404
QSharedPointer<QgsOracleSharedData> mShared;
404405

‎src/providers/oracle/qgsoraclesourceselect.cpp

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -330,11 +330,9 @@ void QgsOracleSourceSelect::on_cmbConnections_currentIndexChanged( const QString
330330
cbxAllowGeometrylessTables->blockSignals( false );
331331

332332
// populate the table list
333-
QgsDataSourceURI uri = QgsOracleConn::connUri( cmbConnections->currentText() );
334-
mConnInfo = uri.connectionInfo();
335-
mUseEstimatedMetadata = uri.useEstimatedMetadata();
333+
mConnInfo = QgsOracleConn::connUri( cmbConnections->currentText() );
336334

337-
QgsDebugMsg( "Connection info: " + uri.connectionInfo() );
335+
QgsDebugMsg( "Connection info: " + mConnInfo.uri() );
338336

339337
loadTableFromCache();
340338
}
@@ -482,7 +480,7 @@ void QgsOracleSourceSelect::addTables()
482480
if ( idx.column() != QgsOracleTableModel::dbtmTable )
483481
continue;
484482

485-
QString uri = mTableModel.layerURI( mProxyModel.mapToSource( idx ), mConnInfo, mUseEstimatedMetadata );
483+
QString uri = mTableModel.layerURI( mProxyModel.mapToSource( idx ), mConnInfo );
486484
if ( uri.isNull() )
487485
continue;
488486

@@ -524,7 +522,7 @@ void QgsOracleSourceSelect::on_btnConnect_clicked()
524522
mTablesTreeDelegate->setConnectionInfo( uri.connectionInfo() );
525523

526524
mColumnTypeThread = new QgsOracleColumnTypeThread( cmbConnections->currentText(),
527-
mUseEstimatedMetadata,
525+
uri.useEstimatedMetadata(),
528526
cbxAllowGeometrylessTables->isChecked() );
529527

530528
connect( mColumnTypeThread, SIGNAL( setLayerType( QgsOracleLayerProperty ) ),
@@ -593,11 +591,6 @@ QStringList QgsOracleSourceSelect::selectedTables()
593591
return mSelectedTables;
594592
}
595593

596-
QString QgsOracleSourceSelect::connectionInfo()
597-
{
598-
return mConnInfo;
599-
}
600-
601594
void QgsOracleSourceSelect::setSql( const QModelIndex &index )
602595
{
603596
if ( !index.parent().isValid() )
@@ -609,7 +602,7 @@ void QgsOracleSourceSelect::setSql( const QModelIndex &index )
609602
QModelIndex idx = mProxyModel.mapToSource( index );
610603
QString tableName = mTableModel.itemFromIndex( idx.sibling( idx.row(), QgsOracleTableModel::dbtmTable ) )->text();
611604

612-
QString uri = mTableModel.layerURI( idx, mConnInfo, mUseEstimatedMetadata );
605+
QString uri = mTableModel.layerURI( idx, mConnInfo );
613606
if ( uri.isNull() )
614607
{
615608
QgsDebugMsg( "no uri" );
@@ -670,16 +663,16 @@ void QgsOracleSourceSelect::loadTableFromCache()
670663
mTableModel.removeRows( 0, mTableModel.rowCount( rootItemIndex ), rootItemIndex );
671664

672665
QString connName = cmbConnections->currentText();
666+
QgsDataSourceURI uri = QgsOracleConn::connUri( connName );
673667
QVector<QgsOracleLayerProperty> layers;
674-
if ( !QgsOracleTableCache::loadFromCache( connName, _currentFlags( connName, mUseEstimatedMetadata, cbxAllowGeometrylessTables->isChecked() ), layers ) )
668+
if ( !QgsOracleTableCache::loadFromCache( connName, _currentFlags( connName, uri.useEstimatedMetadata(), cbxAllowGeometrylessTables->isChecked() ), layers ) )
675669
return;
676670

677671
foreach ( const QgsOracleLayerProperty& layerProperty, layers )
678672
mTableModel.addTableEntry( layerProperty );
679673

680674
QApplication::setOverrideCursor( Qt::BusyCursor );
681675

682-
QgsDataSourceURI uri = QgsOracleConn::connUri( connName );
683676

684677
mIsConnected = true;
685678
mTablesTreeDelegate->setConnectionInfo( uri.connectionInfo() );

‎src/providers/oracle/qgsoraclesourceselect.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class QgsOracleSourceSelectDelegate : public QItemDelegate
5353
void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const;
5454
void setEditorData( QWidget *editor, const QModelIndex &index ) const;
5555

56-
void setConnectionInfo( const QString& connInfo ) { mConnInfo = connInfo; }
56+
void setConnectionInfo( const QgsDataSourceURI& connInfo ) { mConnInfo = connInfo; }
5757

5858
protected:
5959
void setConn( QgsOracleConn *conn ) const { if ( mConn ) mConn->disconnect(); mConn = conn; }
@@ -66,7 +66,7 @@ class QgsOracleSourceSelectDelegate : public QItemDelegate
6666
}
6767

6868
private:
69-
QString mConnInfo;
69+
QgsDataSourceURI mConnInfo;
7070
//! lazily initialized connection (to detect possible primary keys)
7171
mutable QgsOracleConn *mConn;
7272
};
@@ -92,8 +92,6 @@ class QgsOracleSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
9292
void populateConnectionList();
9393
//! String list containing the selected tables
9494
QStringList selectedTables();
95-
//! Connection info (database, host, user, password)
96-
QString connectionInfo();
9795

9896
signals:
9997
void addDatabaseLayers( QStringList const & layerPathList, QString const & providerKey );
@@ -164,9 +162,8 @@ class QgsOracleSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
164162
QStringList mColumnLabels;
165163
// Our thread for doing long running queries
166164
QgsOracleColumnTypeThread *mColumnTypeThread;
167-
QString mConnInfo;
165+
QgsDataSourceURI mConnInfo;
168166
QStringList mSelectedTables;
169-
bool mUseEstimatedMetadata;
170167
// Storage for the range of layer type icons
171168
QMap<QString, QPair<QString, QIcon> > mLayerIcons;
172169

‎src/providers/oracle/qgsoracletablemodel.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ bool QgsOracleTableModel::setData( const QModelIndex &idx, const QVariant &value
303303
return true;
304304
}
305305

306-
QString QgsOracleTableModel::layerURI( const QModelIndex &index, const QString &connInfo, bool useEstimatedMetadata )
306+
QString QgsOracleTableModel::layerURI( const QModelIndex &index, const QgsDataSourceURI &connInfo )
307307
{
308308
if ( !index.isValid() )
309309
{
@@ -355,7 +355,6 @@ QString QgsOracleTableModel::layerURI( const QModelIndex &index, const QString &
355355

356356
QgsDataSourceURI uri( connInfo );
357357
uri.setDataSource( ownerName, tableName, geomColumnName, sql, pkColumnName );
358-
uri.setUseEstimatedMetadata( useEstimatedMetadata );
359358
uri.setWkbType( wkbType );
360359
uri.setSrid( srid );
361360
uri.disableSelectAtId( !selectAtId );

‎src/providers/oracle/qgsoracletablemodel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class QgsOracleTableModel : public QStandardItemModel
5757

5858
bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole );
5959

60-
QString layerURI( const QModelIndex &index, const QString &connInfo, bool useEstimatedMetadata );
60+
QString layerURI( const QModelIndex &index, const QgsDataSourceURI &connInfo );
6161

6262
static QIcon iconForWkbType( QGis::WkbType type );
6363

‎src/ui/qgsoraclenewconnectionbase.ui

Lines changed: 66 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<string>Connection Information</string>
4646
</property>
4747
<layout class="QGridLayout" name="gridLayout_1">
48-
<item row="11" column="0" colspan="3">
48+
<item row="13" column="0" colspan="3">
4949
<widget class="QCheckBox" name="cb_useEstimatedMetadata">
5050
<property name="toolTip">
5151
<string>Use estimated table statistics for the layer metadata.</string>
@@ -58,9 +58,6 @@
5858
</property>
5959
</widget>
6060
</item>
61-
<item row="4" column="1" colspan="2">
62-
<widget class="QLineEdit" name="txtUsername"/>
63-
</item>
6461
<item row="5" column="0">
6562
<widget class="QLabel" name="TextLabel3_2">
6663
<property name="text">
@@ -71,20 +68,6 @@
7168
</property>
7269
</widget>
7370
</item>
74-
<item row="5" column="1" colspan="2">
75-
<widget class="QLineEdit" name="txtPassword">
76-
<property name="echoMode">
77-
<enum>QLineEdit::Password</enum>
78-
</property>
79-
</widget>
80-
</item>
81-
<item row="6" column="0" colspan="2">
82-
<widget class="QCheckBox" name="chkStoreUsername">
83-
<property name="text">
84-
<string>Save Username</string>
85-
</property>
86-
</widget>
87-
</item>
8871
<item row="4" column="0">
8972
<widget class="QLabel" name="TextLabel3">
9073
<property name="text">
@@ -95,13 +78,6 @@
9578
</property>
9679
</widget>
9780
</item>
98-
<item row="0" column="1" colspan="2">
99-
<widget class="QLineEdit" name="txtName">
100-
<property name="toolTip">
101-
<string>Name of the new connection</string>
102-
</property>
103-
</widget>
104-
</item>
10581
<item row="1" column="0">
10682
<widget class="QLabel" name="label">
10783
<property name="text">
@@ -122,7 +98,7 @@
12298
</property>
12399
</widget>
124100
</item>
125-
<item row="8" column="0" colspan="3">
101+
<item row="10" column="0" colspan="3">
126102
<widget class="QCheckBox" name="cb_geometryColumnsOnly">
127103
<property name="toolTip">
128104
<string>Restrict the displayed tables to those that are in the all_sdo_geom_metadata table</string>
@@ -135,7 +111,7 @@
135111
</property>
136112
</widget>
137113
</item>
138-
<item row="9" column="0" colspan="3">
114+
<item row="11" column="0" colspan="3">
139115
<widget class="QCheckBox" name="cb_userTablesOnly">
140116
<property name="toolTip">
141117
<string>When searching for spatial tables restrict the search to tables that are owned by the user.</string>
@@ -148,7 +124,7 @@
148124
</property>
149125
</widget>
150126
</item>
151-
<item row="10" column="0" colspan="3">
127+
<item row="12" column="0" colspan="3">
152128
<widget class="QCheckBox" name="cb_allowGeometrylessTables">
153129
<property name="text">
154130
<string>Also list tables with no geometry</string>
@@ -168,53 +144,94 @@
168144
</property>
169145
</widget>
170146
</item>
171-
<item row="3" column="1" colspan="2">
172-
<widget class="QLineEdit" name="txtPort">
147+
<item row="2" column="0">
148+
<widget class="QLabel" name="TextLabel1">
173149
<property name="text">
174-
<string>1521</string>
150+
<string>Host</string>
151+
</property>
152+
<property name="buddy">
153+
<cstring>txtHost</cstring>
175154
</property>
176155
</widget>
177156
</item>
178-
<item row="1" column="1" colspan="2">
179-
<widget class="QLineEdit" name="txtDatabase"/>
157+
<item row="14" column="0" colspan="3">
158+
<widget class="QCheckBox" name="cb_onlyExistingTypes">
159+
<property name="toolTip">
160+
<string>Only list the existing geometry types and don't offer to add others.</string>
161+
</property>
162+
<property name="whatsThis">
163+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;When the layer is setup various metadata is required for the Oracle table. This includes information such as the table row count, geometry type and spatial extents of the data in the geometry column. If the table contains a large number of rows determining this metadata is time consuming.&lt;/p&gt;&lt;p&gt;By activating this option the following fast table metadata operations are done:&lt;/p&gt;&lt;p&gt;1) Row count is determined from all_tables.num_rows.&lt;/p&gt;&lt;p&gt;2) Table extents are always determined with the SDO_TUNE.EXTENTS_OF function even if a layer filter is applied.&lt;/p&gt;&lt;p&gt;3) The table geometry is determined from the first 100 non-null geometry rows in the table.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
164+
</property>
165+
<property name="text">
166+
<string>Only existing geometry types</string>
167+
</property>
168+
</widget>
180169
</item>
181-
<item row="6" column="2" rowspan="2">
170+
<item row="8" column="2" rowspan="2">
182171
<widget class="QPushButton" name="btnConnect">
183172
<property name="text">
184173
<string>&amp;Test Connect</string>
185174
</property>
186175
</widget>
187176
</item>
188-
<item row="7" column="0" colspan="2">
189-
<widget class="QCheckBox" name="chkStorePassword">
177+
<item row="4" column="1" colspan="2">
178+
<widget class="QLineEdit" name="txtUsername"/>
179+
</item>
180+
<item row="8" column="0" colspan="2">
181+
<widget class="QCheckBox" name="chkStoreUsername">
190182
<property name="text">
191-
<string>Save Password</string>
183+
<string>Save Username</string>
192184
</property>
193185
</widget>
194186
</item>
195-
<item row="2" column="0">
196-
<widget class="QLabel" name="TextLabel1">
187+
<item row="1" column="1" colspan="2">
188+
<widget class="QLineEdit" name="txtDatabase"/>
189+
</item>
190+
<item row="9" column="0" colspan="2">
191+
<widget class="QCheckBox" name="chkStorePassword">
197192
<property name="text">
198-
<string>Host</string>
193+
<string>Save Password</string>
199194
</property>
200-
<property name="buddy">
201-
<cstring>txtHost</cstring>
195+
</widget>
196+
</item>
197+
<item row="0" column="1" colspan="2">
198+
<widget class="QLineEdit" name="txtName">
199+
<property name="toolTip">
200+
<string>Name of the new connection</string>
202201
</property>
203202
</widget>
204203
</item>
205204
<item row="2" column="1" colspan="2">
206205
<widget class="QLineEdit" name="txtHost"/>
207206
</item>
208-
<item row="12" column="0" colspan="3">
209-
<widget class="QCheckBox" name="cb_onlyExistingTypes">
210-
<property name="toolTip">
211-
<string>Only list the existing geometry types and don't offer to add others.</string>
207+
<item row="5" column="1" colspan="2">
208+
<widget class="QLineEdit" name="txtPassword">
209+
<property name="echoMode">
210+
<enum>QLineEdit::Password</enum>
212211
</property>
213-
<property name="whatsThis">
214-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;When the layer is setup various metadata is required for the Oracle table. This includes information such as the table row count, geometry type and spatial extents of the data in the geometry column. If the table contains a large number of rows determining this metadata is time consuming.&lt;/p&gt;&lt;p&gt;By activating this option the following fast table metadata operations are done:&lt;/p&gt;&lt;p&gt;1) Row count is determined from all_tables.num_rows.&lt;/p&gt;&lt;p&gt;2) Table extents are always determined with the SDO_TUNE.EXTENTS_OF function even if a layer filter is applied.&lt;/p&gt;&lt;p&gt;3) The table geometry is determined from the first 100 non-null geometry rows in the table.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
212+
</widget>
213+
</item>
214+
<item row="3" column="1" colspan="2">
215+
<widget class="QLineEdit" name="txtPort">
216+
<property name="text">
217+
<string>1521</string>
215218
</property>
219+
</widget>
220+
</item>
221+
<item row="6" column="0">
222+
<widget class="QLabel" name="TextLabel3_3">
216223
<property name="text">
217-
<string>Only existing geometry types</string>
224+
<string>Options</string>
225+
</property>
226+
<property name="buddy">
227+
<cstring>txtPassword</cstring>
228+
</property>
229+
</widget>
230+
</item>
231+
<item row="6" column="1" colspan="2">
232+
<widget class="QLineEdit" name="txtOptions">
233+
<property name="echoMode">
234+
<enum>QLineEdit::Normal</enum>
218235
</property>
219236
</widget>
220237
</item>

0 commit comments

Comments
 (0)
Please sign in to comment.