From 74ae72a565fcfe2c1a15c158deb81f012bff0c48 Mon Sep 17 00:00:00 2001 From: Alessandro Pasotti Date: Fri, 13 Sep 2024 09:24:23 +0200 Subject: [PATCH 1/2] Auth storage API fix debug code with QT6 --- src/core/auth/qgsauthconfigurationstoragedb.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/core/auth/qgsauthconfigurationstoragedb.cpp b/src/core/auth/qgsauthconfigurationstoragedb.cpp index 3801617133f9..4dc67ab0c6c6 100644 --- a/src/core/auth/qgsauthconfigurationstoragedb.cpp +++ b/src/core/auth/qgsauthconfigurationstoragedb.cpp @@ -169,17 +169,25 @@ bool QgsAuthConfigurationStorageDb::authDbQuery( QSqlQuery *query, const QString auto boundQuery = []( const QSqlQuery * query ) -> QString { -#ifdef QGISDEBUG QString str = query->lastQuery(); +#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) QMapIterator it( query->boundValues() ); +#else + const QStringList keys = query->boundValueNames(); + const QVariantList values = query->boundValues(); + QMap boundValues; + for ( const auto &key : std::as_const( keys ) ) + { + boundValues.insert( key, values.at( keys.indexOf( key ) ).toString() ); + } + QMapIterator it = QMapIterator( boundValues ); +#endif while ( it.hasNext() ) { it.next(); str.replace( it.key(), it.value().toString() ); } return str; -#endif - return query->executedQuery(); }; if ( !result ) From a0ec39af65b3bc04cc50f8e5290c26ab1e49c7c6 Mon Sep 17 00:00:00 2001 From: Alessandro Pasotti Date: Mon, 16 Sep 2024 14:32:11 +0200 Subject: [PATCH 2/2] Update src/core/auth/qgsauthconfigurationstoragedb.cpp Co-authored-by: Julien Cabieces --- src/core/auth/qgsauthconfigurationstoragedb.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/auth/qgsauthconfigurationstoragedb.cpp b/src/core/auth/qgsauthconfigurationstoragedb.cpp index 4dc67ab0c6c6..6147d837821d 100644 --- a/src/core/auth/qgsauthconfigurationstoragedb.cpp +++ b/src/core/auth/qgsauthconfigurationstoragedb.cpp @@ -176,9 +176,9 @@ bool QgsAuthConfigurationStorageDb::authDbQuery( QSqlQuery *query, const QString const QStringList keys = query->boundValueNames(); const QVariantList values = query->boundValues(); QMap boundValues; - for ( const auto &key : std::as_const( keys ) ) + for ( int i=0; i it = QMapIterator( boundValues ); #endif