run prepare-commit on DB2 fixes for #20337

This commit is contained in:
dwadler 2018-11-11 10:04:52 -05:00 committed by Nyall Dawson
parent c339dd49fb
commit d998465db9
3 changed files with 23 additions and 22 deletions

View File

@ -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;
}

View File

@ -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 ) )
{

View File

@ -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