void QgsOracleColumnTypeThread::run() { mStopped = false; QString conninfo = QgsOracleConn::toPoolName( QgsOracleConn::connUri( mName ) ); QgsOracleConn *conn = QgsOracleConnPool::instance()->acquireConnection( conninfo ); if ( !conn ) { QgsDebugMsg( "Connection failed - " + conninfo ); mStopped = true; return; } emit progressMessage( tr( "Retrieving tables of %1…" ).arg( mName ) ); QVector<QgsOracleLayerProperty> layerProperties; if ( !conn->supportedLayers( layerProperties, mSchema, QgsOracleConn::geometryColumnsOnly( mName ), QgsOracleConn::userTablesOnly( mName ), mAllowGeometrylessTables ) || layerProperties.isEmpty() ) { return; } int i = 0, n = layerProperties.size(); for ( QVector<QgsOracleLayerProperty>::iterator it = layerProperties.begin(), end = layerProperties.end(); it != end; ++it ) { QgsOracleLayerProperty &layerProperty = *it; if ( !mStopped ) { emit progress( i++, n ); emit progressMessage( tr( "Scanning column %1.%2.%3…" ) .arg( layerProperty.ownerName, layerProperty.tableName, layerProperty.geometryColName ) ); conn->retrieveLayerTypes( layerProperty, mUseEstimatedMetadata, QgsOracleConn::onlyExistingTypes( mName ) ); } if ( mStopped ) { layerProperty.types.clear(); layerProperty.srids.clear(); } // Now tell the layer list dialog box... emit setLayerType( layerProperty ); } // store the list for later use (cache) if ( !mStopped ) mLayerProperties = layerProperties; emit progress( 0, 0 ); emit progressMessage( tr( "Table retrieval finished." ) ); QgsOracleConnPool::instance()->releaseConnection( conn ); }
void QgsOracleColumnTypeThread::run() { QgsDataSourceURI uri = QgsOracleConn::connUri( mName ); QgsOracleConn *conn = QgsOracleConn::connectDb( uri.connectionInfo() ); if ( !conn ) { QgsDebugMsg( "Connection failed - " + uri.connectionInfo() ); return; } mStopped = false; emit progressMessage( tr( "Retrieving tables of %1..." ).arg( mName ) ); QVector<QgsOracleLayerProperty> layerProperties; if ( !conn->supportedLayers( layerProperties, QgsOracleConn::geometryColumnsOnly( mName ), QgsOracleConn::userTablesOnly( mName ), mAllowGeometrylessTables ) || layerProperties.isEmpty() ) { return; } int i = 0, n = layerProperties.size(); for ( QVector<QgsOracleLayerProperty>::iterator it = layerProperties.begin(), end = layerProperties.end(); it != end; ++it ) { QgsOracleLayerProperty &layerProperty = *it; if ( !mStopped ) { emit progress( i++, n ); emit progressMessage( tr( "Scanning column %1.%2.%3..." ) .arg( layerProperty.ownerName ) .arg( layerProperty.tableName ) .arg( layerProperty.geometryColName ) ); conn->retrieveLayerTypes( layerProperty, mUseEstimatedMetadata, QgsOracleConn::onlyExistingTypes( mName ) ); } if ( mStopped ) { layerProperty.types.clear(); layerProperty.srids.clear(); } // Now tell the layer list dialog box... emit setLayerType( layerProperty ); } emit progress( 0, 0 ); emit progressMessage( tr( "Table retrieval finished." ) ); conn->disconnect(); }