Skip to content

Commit f93faac

Browse files
committedJun 26, 2016
oracle provider: by default skip additional geometry columns (on 64bit
Windows/Linux OCI crashes when there are more than three geometry columns) (cherry picked from commit 4b00182)
1 parent ed786d1 commit f93faac

File tree

7 files changed

+34
-8
lines changed

7 files changed

+34
-8
lines changed
 

‎python/plugins/db_manager/db_plugins/oracle/connector.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ def __init__(self, uri, connName):
8686
'allowGeometrylessTables').lower() == "true"
8787
self.onlyExistingTypes = uri.param(
8888
'onlyExistingTypes').lower() == "true"
89+
self.includeGeoAttributes = uri.param(
90+
'includeGeoAttributes').lower() == "true"
8991

9092
# For refreshing
9193
self.populated = False

‎python/plugins/db_manager/db_plugins/oracle/plugin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ def connect(self, parent=None):
112112
settings.value("allowGeometrylessTables", False, type=bool)))
113113
uri.setParam('onlyExistingTypes', unicode(
114114
settings.value("onlyExistingTypes", False, type=bool)))
115+
uri.setParam('includeGeoAttributes', unicode(
116+
settings.value("includeGeoAttributes", False, type=bool)))
115117

116118
settings.endGroup()
117119

‎src/providers/oracle/qgsoracleconn.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,7 @@ void QgsOracleConn::deleteConnection( QString theConnName )
657657
settings.remove( key + "/allowGeometrylessTables" );
658658
settings.remove( key + "/estimatedMetadata" );
659659
settings.remove( key + "/onlyExistingTypes" );
660+
settings.remove( key + "/includeGeoAttributes" );
660661
settings.remove( key + "/saveUsername" );
661662
settings.remove( key + "/savePassword" );
662663
settings.remove( key + "/save" );

‎src/providers/oracle/qgsoraclenewconnection.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ QgsOracleNewConnection::QgsOracleNewConnection( QWidget *parent, const QString&
5151
cb_allowGeometrylessTables->setChecked( settings.value( key + "/allowGeometrylessTables", false ).toBool() );
5252
cb_useEstimatedMetadata->setChecked( settings.value( key + "/estimatedMetadata", false ).toBool() );
5353
cb_onlyExistingTypes->setChecked( settings.value( key + "/onlyExistingTypes", true ).toBool() );
54+
cb_includeGeoAttributes->setChecked( settings.value( key + "/includeGeoAttributes", false ).toBool() );
5455

5556
if ( settings.value( key + "/saveUsername" ).toString() == "true" )
5657
{
@@ -125,6 +126,7 @@ void QgsOracleNewConnection::accept()
125126
settings.setValue( baseKey + "/allowGeometrylessTables", cb_allowGeometrylessTables->isChecked() );
126127
settings.setValue( baseKey + "/estimatedMetadata", cb_useEstimatedMetadata->isChecked() ? "true" : "false" );
127128
settings.setValue( baseKey + "/onlyExistingTypes", cb_onlyExistingTypes->isChecked() ? "true" : "false" );
129+
settings.setValue( baseKey + "/includeGeoAttributes", cb_includeGeoAttributes->isChecked() ? "true" : "false" );
128130
settings.setValue( baseKey + "/saveUsername", chkStoreUsername->isChecked() ? "true" : "false" );
129131
settings.setValue( baseKey + "/savePassword", chkStorePassword->isChecked() ? "true" : "false" );
130132
settings.setValue( baseKey + "/dboptions", txtOptions->text() );

‎src/providers/oracle/qgsoracleprovider.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ QgsOracleProvider::QgsOracleProvider( QString const & uri )
6969
mSrid = mUri.srid().toInt();
7070
mRequestedGeomType = mUri.wkbType();
7171
mUseEstimatedMetadata = mUri.useEstimatedMetadata();
72+
mIncludeGeoAttributes = mUri.hasParam( "includegeoattributes" ) ? mUri.param( "includegeoattributes" ) == "true" : false;
7273

7374
mConnection = QgsOracleConn::connectDb( mUri.connectionInfo() );
7475
if ( !mConnection )
@@ -602,11 +603,12 @@ bool QgsOracleProvider::loadFields()
602603
",t.char_used"
603604
",t.data_default"
604605
" FROM all_tab_columns t"
605-
" WHERE t.owner=%1 AND t.table_name=%2%3"
606+
" WHERE t.owner=%1 AND t.table_name=%2%3%4"
606607
" ORDER BY t.column_id" )
607608
.arg( quotedValue( mOwnerName ) )
608609
.arg( quotedValue( mTableName ) )
609610
.arg( mGeometryColumn.isEmpty() ? "" : QString( " AND t.column_name<>%1 " ).arg( quotedValue( mGeometryColumn ) ) )
611+
.arg( mIncludeGeoAttributes ? "" : " AND (t.data_type_owner<>'MDSYS' OR t.data_type<>'SDO_GEOMETRY')" )
610612
) )
611613
{
612614
while ( qry.next() )

‎src/providers/oracle/qgsoracleprovider.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,9 @@ class QgsOracleProvider : public QgsVectorDataProvider
348348
/* Use estimated metadata. Uses fast table counts, geometry type and extent determination */
349349
bool mUseEstimatedMetadata;
350350

351+
/* Include additional geo attributes */
352+
bool mIncludeGeoAttributes;
353+
351354
struct OracleFieldNotFound {}; //! Exception to throw
352355

353356
struct OracleException

‎src/ui/qgsoraclenewconnectionbase.ui

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@
4545
<string>Connection Information</string>
4646
</property>
4747
<layout class="QGridLayout" name="gridLayout_1">
48+
<item row="9" column="0" colspan="2">
49+
<widget class="QCheckBox" name="chkStorePassword">
50+
<property name="text">
51+
<string>Save Password</string>
52+
</property>
53+
</widget>
54+
</item>
4855
<item row="13" column="0" colspan="3">
4956
<widget class="QCheckBox" name="cb_useEstimatedMetadata">
5057
<property name="toolTip">
@@ -187,13 +194,6 @@
187194
<item row="1" column="1" colspan="2">
188195
<widget class="QLineEdit" name="txtDatabase"/>
189196
</item>
190-
<item row="9" column="0" colspan="2">
191-
<widget class="QCheckBox" name="chkStorePassword">
192-
<property name="text">
193-
<string>Save Password</string>
194-
</property>
195-
</widget>
196-
</item>
197197
<item row="0" column="1" colspan="2">
198198
<widget class="QLineEdit" name="txtName">
199199
<property name="toolTip">
@@ -235,6 +235,19 @@
235235
</property>
236236
</widget>
237237
</item>
238+
<item row="15" column="0" colspan="3">
239+
<widget class="QCheckBox" name="cb_includeGeoAttributes">
240+
<property name="toolTip">
241+
<string/>
242+
</property>
243+
<property name="whatsThis">
244+
<string/>
245+
</property>
246+
<property name="text">
247+
<string>Include additional geometry attributes</string>
248+
</property>
249+
</widget>
250+
</item>
238251
</layout>
239252
</widget>
240253
</item>
@@ -257,6 +270,7 @@
257270
<tabstop>cb_allowGeometrylessTables</tabstop>
258271
<tabstop>cb_useEstimatedMetadata</tabstop>
259272
<tabstop>cb_onlyExistingTypes</tabstop>
273+
<tabstop>cb_includeGeoAttributes</tabstop>
260274
<tabstop>buttonBox</tabstop>
261275
</tabstops>
262276
<resources/>

0 commit comments

Comments
 (0)
Please sign in to comment.