Skip to content

Commit

Permalink
oracle provider: by default skip additional geometry columns (on 64bit
Browse files Browse the repository at this point in the history
Windows/Linux OCI crashes when there are more than three geometry
columns)

(cherry picked from commit 4b00182)
  • Loading branch information
jef-n committed Jun 26, 2016
1 parent ed786d1 commit f93faac
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 8 deletions.
2 changes: 2 additions & 0 deletions python/plugins/db_manager/db_plugins/oracle/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ def __init__(self, uri, connName):
'allowGeometrylessTables').lower() == "true"
self.onlyExistingTypes = uri.param(
'onlyExistingTypes').lower() == "true"
self.includeGeoAttributes = uri.param(
'includeGeoAttributes').lower() == "true"

# For refreshing
self.populated = False
Expand Down
2 changes: 2 additions & 0 deletions python/plugins/db_manager/db_plugins/oracle/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ def connect(self, parent=None):
settings.value("allowGeometrylessTables", False, type=bool)))
uri.setParam('onlyExistingTypes', unicode(
settings.value("onlyExistingTypes", False, type=bool)))
uri.setParam('includeGeoAttributes', unicode(
settings.value("includeGeoAttributes", False, type=bool)))

settings.endGroup()

Expand Down
1 change: 1 addition & 0 deletions src/providers/oracle/qgsoracleconn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,7 @@ void QgsOracleConn::deleteConnection( QString theConnName )
settings.remove( key + "/allowGeometrylessTables" );
settings.remove( key + "/estimatedMetadata" );
settings.remove( key + "/onlyExistingTypes" );
settings.remove( key + "/includeGeoAttributes" );
settings.remove( key + "/saveUsername" );
settings.remove( key + "/savePassword" );
settings.remove( key + "/save" );
Expand Down
2 changes: 2 additions & 0 deletions src/providers/oracle/qgsoraclenewconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ QgsOracleNewConnection::QgsOracleNewConnection( QWidget *parent, const QString&
cb_allowGeometrylessTables->setChecked( settings.value( key + "/allowGeometrylessTables", false ).toBool() );
cb_useEstimatedMetadata->setChecked( settings.value( key + "/estimatedMetadata", false ).toBool() );
cb_onlyExistingTypes->setChecked( settings.value( key + "/onlyExistingTypes", true ).toBool() );
cb_includeGeoAttributes->setChecked( settings.value( key + "/includeGeoAttributes", false ).toBool() );

if ( settings.value( key + "/saveUsername" ).toString() == "true" )
{
Expand Down Expand Up @@ -125,6 +126,7 @@ void QgsOracleNewConnection::accept()
settings.setValue( baseKey + "/allowGeometrylessTables", cb_allowGeometrylessTables->isChecked() );
settings.setValue( baseKey + "/estimatedMetadata", cb_useEstimatedMetadata->isChecked() ? "true" : "false" );
settings.setValue( baseKey + "/onlyExistingTypes", cb_onlyExistingTypes->isChecked() ? "true" : "false" );
settings.setValue( baseKey + "/includeGeoAttributes", cb_includeGeoAttributes->isChecked() ? "true" : "false" );
settings.setValue( baseKey + "/saveUsername", chkStoreUsername->isChecked() ? "true" : "false" );
settings.setValue( baseKey + "/savePassword", chkStorePassword->isChecked() ? "true" : "false" );
settings.setValue( baseKey + "/dboptions", txtOptions->text() );
Expand Down
4 changes: 3 additions & 1 deletion src/providers/oracle/qgsoracleprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ QgsOracleProvider::QgsOracleProvider( QString const & uri )
mSrid = mUri.srid().toInt();
mRequestedGeomType = mUri.wkbType();
mUseEstimatedMetadata = mUri.useEstimatedMetadata();
mIncludeGeoAttributes = mUri.hasParam( "includegeoattributes" ) ? mUri.param( "includegeoattributes" ) == "true" : false;

mConnection = QgsOracleConn::connectDb( mUri.connectionInfo() );
if ( !mConnection )
Expand Down Expand Up @@ -602,11 +603,12 @@ bool QgsOracleProvider::loadFields()
",t.char_used"
",t.data_default"
" FROM all_tab_columns t"
" WHERE t.owner=%1 AND t.table_name=%2%3"
" WHERE t.owner=%1 AND t.table_name=%2%3%4"
" ORDER BY t.column_id" )
.arg( quotedValue( mOwnerName ) )
.arg( quotedValue( mTableName ) )
.arg( mGeometryColumn.isEmpty() ? "" : QString( " AND t.column_name<>%1 " ).arg( quotedValue( mGeometryColumn ) ) )
.arg( mIncludeGeoAttributes ? "" : " AND (t.data_type_owner<>'MDSYS' OR t.data_type<>'SDO_GEOMETRY')" )
) )
{
while ( qry.next() )
Expand Down
3 changes: 3 additions & 0 deletions src/providers/oracle/qgsoracleprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,9 @@ class QgsOracleProvider : public QgsVectorDataProvider
/* Use estimated metadata. Uses fast table counts, geometry type and extent determination */
bool mUseEstimatedMetadata;

/* Include additional geo attributes */
bool mIncludeGeoAttributes;

struct OracleFieldNotFound {}; //! Exception to throw

struct OracleException
Expand Down
28 changes: 21 additions & 7 deletions src/ui/qgsoraclenewconnectionbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@
<string>Connection Information</string>
</property>
<layout class="QGridLayout" name="gridLayout_1">
<item row="9" column="0" colspan="2">
<widget class="QCheckBox" name="chkStorePassword">
<property name="text">
<string>Save Password</string>
</property>
</widget>
</item>
<item row="13" column="0" colspan="3">
<widget class="QCheckBox" name="cb_useEstimatedMetadata">
<property name="toolTip">
Expand Down Expand Up @@ -187,13 +194,6 @@
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="txtDatabase"/>
</item>
<item row="9" column="0" colspan="2">
<widget class="QCheckBox" name="chkStorePassword">
<property name="text">
<string>Save Password</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QLineEdit" name="txtName">
<property name="toolTip">
Expand Down Expand Up @@ -235,6 +235,19 @@
</property>
</widget>
</item>
<item row="15" column="0" colspan="3">
<widget class="QCheckBox" name="cb_includeGeoAttributes">
<property name="toolTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Include additional geometry attributes</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand All @@ -257,6 +270,7 @@
<tabstop>cb_allowGeometrylessTables</tabstop>
<tabstop>cb_useEstimatedMetadata</tabstop>
<tabstop>cb_onlyExistingTypes</tabstop>
<tabstop>cb_includeGeoAttributes</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
Expand Down

0 comments on commit f93faac

Please sign in to comment.