Skip to content

Commit

Permalink
merged DB2 updates
Browse files Browse the repository at this point in the history
[FEATURE] New vector data provider for DB2 sources
  • Loading branch information
dwadler authored and nyalldawson committed Apr 3, 2016
1 parent 883016f commit 5fe19c5
Show file tree
Hide file tree
Showing 37 changed files with 6,660 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Expand Up @@ -239,6 +239,10 @@ SET (HAVE_SPATIALITE TRUE)
# following variable is used in qgsconfig.h
SET (HAVE_MSSQL TRUE)


# following variable is used in qgsconfig.h
SET (HAVE_DB2 TRUE)

SET (WITH_QTWEBKIT TRUE CACHE INTERNAL "Enable QtWebkit support")
IF (WITH_QTWEBKIT)
ADD_DEFINITIONS(-DWITH_QTWEBKIT)
Expand Down
2 changes: 2 additions & 0 deletions cmake_templates/qgsconfig.h.in
Expand Up @@ -46,6 +46,8 @@

#cmakedefine HAVE_MSSQL

#cmakedefine HAVE_DB2

#cmakedefine HAVE_ORACLE

#cmakedefine HAVE_PYTHON
Expand Down
2 changes: 2 additions & 0 deletions images/images.qrc
Expand Up @@ -132,6 +132,7 @@
<file>themes/default/mActionAddMap.png</file>
<file>themes/default/mActionAddMap.svg</file>
<file>themes/default/mActionAddMssqlLayer.svg</file>
<file>themes/default/mActionAddDb2Layer.svg</file>
<file>themes/default/mActionAddNonDbLayer.png</file>
<file>themes/default/mActionAddOgrLayer.svg</file>
<file>themes/default/mActionAddOracleLayer.svg</file>
Expand Down Expand Up @@ -361,6 +362,7 @@
<file>themes/default/mIconDataDefineExpression.svg</file>
<file>themes/default/mIconDataDefineExpressionError.svg</file>
<file>themes/default/mIconDataDefineExpressionOn.svg</file>
<file>themes/default/mIconDb2.svg</file>
<file>themes/default/mIconDbSchema.png</file>
<file>themes/default/mIconDelete.png</file>
<file>themes/default/mIconDeselected.svg</file>
Expand Down
138 changes: 138 additions & 0 deletions images/themes/default/mActionAddDb2Layer.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
112 changes: 112 additions & 0 deletions images/themes/default/mIconDb2.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions python/core/qgsdatasourceuri.sip
Expand Up @@ -144,6 +144,12 @@ class QgsDataSourceURI
QString database() const;
//! Returns the port
QString port() const;
//! Returns the driver
// @note added in QGIS 2.16
QString driver() const;
//! Sets the driver name
// @note added in QGIS 2.16
void setDriver( const QString& driver );
//! Returns the password
QString password() const;
//! Returns the SSL mode
Expand Down
27 changes: 27 additions & 0 deletions src/app/qgisapp.cpp
Expand Up @@ -1425,6 +1425,7 @@ void QgisApp::createActions()
connect( mActionAddPgLayer, SIGNAL( triggered() ), this, SLOT( addDatabaseLayer() ) );
connect( mActionAddSpatiaLiteLayer, SIGNAL( triggered() ), this, SLOT( addSpatiaLiteLayer() ) );
connect( mActionAddMssqlLayer, SIGNAL( triggered() ), this, SLOT( addMssqlLayer() ) );
connect( mActionAddDb2Layer, SIGNAL( triggered() ), this, SLOT( addDb2Layer() ) );
connect( mActionAddOracleLayer, SIGNAL( triggered() ), this, SLOT( addOracleLayer() ) );
connect( mActionAddWmsLayer, SIGNAL( triggered() ), this, SLOT( addWmsLayer() ) );
connect( mActionAddWcsLayer, SIGNAL( triggered() ), this, SLOT( addWcsLayer() ) );
Expand Down Expand Up @@ -1555,6 +1556,11 @@ void QgisApp::createActions()
mActionAddMssqlLayer = 0;
#endif

#ifndef HAVE_DB2
delete mActionAddDb2Layer;
mActionAddDb2Layer = 0;
#endif

#ifndef HAVE_ORACLE
delete mActionAddOracleLayer;
mActionAddOracleLayer = nullptr;
Expand Down Expand Up @@ -2221,6 +2227,9 @@ void QgisApp::setTheme( const QString& theThemeName )
#ifdef HAVE_MSSQL
mActionAddMssqlLayer->setIcon( QgsApplication::getThemeIcon( "/mActionAddMssqlLayer.svg" ) );
#endif
#ifdef HAVE_DB2
mActionAddDb2Layer->setIcon( QgsApplication::getThemeIcon( "/mActionAddDb2Layer.svg" ) );
#endif
#ifdef HAVE_ORACLE
mActionAddOracleLayer->setIcon( QgsApplication::getThemeIcon( "/mActionAddOracleLayer.svg" ) );
#endif
Expand Down Expand Up @@ -3872,6 +3881,24 @@ void QgisApp::addMssqlLayer()
#endif
} // QgisApp::addMssqlLayer()

void QgisApp::addDb2Layer()
{
#ifdef HAVE_DB2
// show the DB2 dialog
QgsDebugMsg( "Show dialog for DB2 " );
QDialog *dbs = dynamic_cast<QDialog*>( QgsProviderRegistry::instance()->selectWidget( "DB2", this ) );
if ( !dbs )
{
QMessageBox::warning( this, tr( "DB2" ), tr( "Cannot get DB2 select dialog from provider." ) );
return;
}
connect( dbs, SIGNAL( addDatabaseLayers( QStringList const &, QString const & ) ),
this, SLOT( addDatabaseLayers( QStringList const &, QString const & ) ) );
dbs->exec();
delete dbs;
#endif
} // QgisApp::addDb2Layer()

void QgisApp::addOracleLayer()
{
#ifdef HAVE_ORACLE
Expand Down
4 changes: 4 additions & 0 deletions src/app/qgisapp.h
Expand Up @@ -721,6 +721,10 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
//! Add a MSSQL layer to the map
void addMssqlLayer();
//#endif
//#ifdef HAVE_DB2
//! Add a DB2 layer to the map
void addDb2Layer();
//#endif
//#ifdef HAVE_ORACLE
//! Add a Oracle layer to the map
void addOracleLayer();
Expand Down
1 change: 1 addition & 0 deletions src/auth/basic/qgsauthbasicmethod.cpp
Expand Up @@ -33,6 +33,7 @@ QgsAuthBasicMethod::QgsAuthBasicMethod()
setExpansions( QgsAuthMethod::NetworkRequest | QgsAuthMethod::DataSourceURI );
setDataProviders( QStringList()
<< "postgres"
<< "db2"
<< "ows"
<< "wfs" // convert to lowercase
<< "wcs"
Expand Down

0 comments on commit 5fe19c5

Please sign in to comment.