Skip to content
Permalink
Browse files

run prepare-commit on DB2 fixes for #20337

  • Loading branch information
dwadler authored and nyalldawson committed Nov 11, 2018
1 parent c339dd4 commit d998465db99f14e55d3c2e8d1509dfa37ee97379
@@ -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

0 comments on commit d998465

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