Skip to content
Permalink
Browse files

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)
  • Loading branch information
jef-n committed Jun 26, 2016
1 parent ed786d1 commit f93faac497978efbdeccf92693edcfb497365d5f
@@ -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
@@ -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()

@@ -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" );
@@ -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" )
{
@@ -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() );
@@ -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 )
@@ -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() )
@@ -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
@@ -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">
@@ -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">
@@ -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>
@@ -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/>

0 comments on commit f93faac

Please sign in to comment.
You can’t perform that action at this time.