Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
|
@@ -5,7 +5,7 @@ |
|
|
Copyright : (C) 2016 by David Adler |
|
|
Shirley Xiao, David Nguyen |
|
|
Email : dadler at adtechgeospatial.com |
|
|
xshirley2012 at yahoo.com, davidng0123 at gmail.com |
|
|
xshirley2012 at yahoo.com, davidng0123 at gmail.com |
|
|
Adapted from MSSQL provider by Tamas Szekeres |
|
|
**************************************************************************** |
|
|
* |
|
@@ -302,23 +302,23 @@ bool QgsDb2FeatureIterator::fetchFeature( QgsFeature &feature ) |
|
|
if ( !mDatabase.isValid() ) |
|
|
{ |
|
|
// No existing connection, so set it up now. It's safe to do here as we're now in |
|
|
// the thread were iteration is actually occurring. |
|
|
// connect to the database |
|
|
QString errMsg; |
|
|
QgsDebugMsg( QStringLiteral( "fetchFeature getDatabase" ) ); |
|
|
mDatabase = QgsDb2Provider::getDatabase( mSource->mConnInfo, errMsg ); |
|
|
QgsDebugMsg( QStringLiteral( "fetchFeature back from getDatabase" ) ); |
|
|
if ( !errMsg.isEmpty() ) |
|
|
{ |
|
|
QgsDebugMsg( "Failed to open database: " + errMsg ); |
|
|
return false; |
|
|
} |
|
|
// the thread were iteration is actually occurring. |
|
|
// connect to the database |
|
|
QString errMsg; |
|
|
QgsDebugMsg( QStringLiteral( "fetchFeature getDatabase" ) ); |
|
|
mDatabase = QgsDb2Provider::getDatabase( mSource->mConnInfo, errMsg ); |
|
|
QgsDebugMsg( QStringLiteral( "fetchFeature back from getDatabase" ) ); |
|
|
if ( !errMsg.isEmpty() ) |
|
|
{ |
|
|
QgsDebugMsg( "Failed to open database: " + errMsg ); |
|
|
return false; |
|
|
} |
|
|
|
|
|
// create sql query |
|
|
mQuery.reset( new QSqlQuery( mDatabase ) ); |
|
|
// create sql query |
|
|
mQuery.reset( new QSqlQuery( mDatabase ) ); |
|
|
|
|
|
// start selection |
|
|
if ( !rewind() ) |
|
|
// start selection |
|
|
if ( !rewind() ) |
|
|
return false; |
|
|
} |
|
|
|
|
|
|
@@ -5,7 +5,7 @@ |
|
|
Copyright : (C) 2016 by David Adler |
|
|
Shirley Xiao, David Nguyen |
|
|
Email : dadler at adtechgeospatial.com |
|
|
xshirley2012 at yahoo.com, davidng0123 at gmail.com |
|
|
xshirley2012 at yahoo.com, davidng0123 at gmail.com |
|
|
Adapted from MSSQL provider by Tamas Szekeres |
|
|
**************************************************************************** |
|
|
* |
|
@@ -192,7 +192,7 @@ QSqlDatabase QgsDb2Provider::getDatabase( const QString &connInfo, QString &errM |
|
|
// using the thread address as connection name. |
|
|
const QString threadSafeConnectionName = dbConnectionName( connectionName ); |
|
|
QgsDebugMsg( "threadSafeConnectionName: " + threadSafeConnectionName ); |
|
|
|
|
|
|
|
|
/* if new database connection */ |
|
|
if ( !QSqlDatabase::contains( threadSafeConnectionName ) ) |
|
|
{ |
|
|
|
@@ -5,7 +5,7 @@ |
|
|
Copyright : (C) 2016 by David Adler |
|
|
Shirley Xiao, David Nguyen |
|
|
Email : dadler at adtechgeospatial.com |
|
|
xshirley2012 at yahoo.com, davidng0123 at gmail.com |
|
|
xshirley2012 at yahoo.com, davidng0123 at gmail.com |
|
|
**************************************************************************** |
|
|
* |
|
|
* This program is free software; you can redistribute it and/or modify |
|
@@ -118,9 +118,10 @@ class QgsDb2Provider : public QgsVectorDataProvider |
|
|
private: |
|
|
static void db2WkbTypeAndDimension( QgsWkbTypes::Type wkbType, QString &geometryType, int &dim ); |
|
|
static QString db2TypeName( int typeId ); |
|
|
/** |
|
|
* Returns a thread-safe connection name for use with QSqlDatabase |
|
|
*/ |
|
|
|
|
|
/** |
|
|
* Returns a thread-safe connection name for use with QSqlDatabase |
|
|
*/ |
|
|
static QString dbConnectionName( const QString &name ); |
|
|
|
|
|
QgsFields mAttributeFields; //fields |
|
|