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)
  • Loading branch information
jef-n committed Jun 23, 2016
1 parent f473521 commit 4b00182482a2e897c8318fe4b46fa7d5dcc8ac6d
@@ -84,6 +84,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
@@ -105,6 +105,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()

@@ -678,6 +678,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" );
@@ -52,6 +52,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" )
{
@@ -126,6 +127,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() );
@@ -70,6 +70,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 );
if ( !mConnection )
@@ -605,11 +606,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() )
@@ -358,6 +358,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">
@@ -252,6 +252,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>
@@ -275,6 +288,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 4b00182

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