Skip to content
Permalink
Browse files
Implement missing API function in QgsHanaProviderConnection
  • Loading branch information
mrylov authored and nyalldawson committed Oct 27, 2021
1 parent 8d7110f commit 3d55a145539cae8b054f61f02f1c0e71c657b783
Showing with 17 additions and 1 deletion.
  1. +14 −1 src/providers/hana/qgshanaproviderconnection.cpp
  2. +3 −0 src/providers/hana/qgshanaproviderconnection.h
@@ -56,7 +56,7 @@ bool QgsHanaProviderResultIterator::hasNextRowPrivate() const

long long QgsHanaProviderResultIterator::rowCountPrivate() const
{
// TODO: hana team, this is for you.
// The HANA ODBC driver doesn't support it.
return static_cast<long long>( Qgis::FeatureCountState::UnknownCount );
}

@@ -475,6 +475,19 @@ QList<QgsVectorDataProvider::NativeType> QgsHanaProviderConnection::nativeTypes(
return types;
}

QgsAbstractDatabaseProviderConnection::SqlVectorLayerOptions QgsHanaProviderConnection::sqlOptions( const QString &layerSource )
{
SqlVectorLayerOptions options;
const QgsDataSourceUri uri( layerSource );
options.primaryKeyColumns = uri.keyColumn().split( ',' );
options.disableSelectAtId = uri.selectAtIdDisabled();
options.geometryColumn = uri.geometryColumn();
options.filter = uri.sql();
const QString trimmedTable { uri.table().trimmed() };
options.sql = trimmedTable.startsWith( '(' ) ? trimmedTable.mid( 1 ).chopped( 1 ) : QStringLiteral( "SELECT * FROM %1" ).arg( uri.quotedTablename() );
return options;
}

QVariantList QgsHanaEmptyProviderResultIterator::nextRowPrivate()
{
return QVariantList();
@@ -78,6 +78,9 @@ class QgsHanaProviderConnection : public QgsAbstractDatabaseProviderConnection
void remove( const QString &name ) const override;
QIcon icon() const override;
QList<QgsVectorDataProvider::NativeType> nativeTypes() const override;
//QgsVectorLayer *createSqlVectorLayer( const SqlVectorLayerOptions &options ) const override;
//QMultiMap<Qgis::SqlKeywordCategory, QStringList> sqlDictionary() override;
SqlVectorLayerOptions sqlOptions( const QString &layerSource ) override;

private:
QgsHanaConnectionRef createConnection() const;

0 comments on commit 3d55a14

Please sign in to comment.