Skip to content

Commit

Permalink
run prepare-commit on DB2 fixes for #20337
Browse files Browse the repository at this point in the history
  • Loading branch information
dwadler authored and nyalldawson committed Nov 20, 2018
1 parent c339dd4 commit d998465
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
32 changes: 16 additions & 16 deletions src/providers/db2/qgsdb2featureiterator.cpp
Expand Up @@ -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
****************************************************************************
*
Expand Down Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/providers/db2/qgsdb2provider.cpp
Expand Up @@ -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
****************************************************************************
*
Expand Down Expand Up @@ -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 ) )
{
Expand Down
9 changes: 5 additions & 4 deletions src/providers/db2/qgsdb2provider.h
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d998465

Please sign in to comment.