Skip to content

Commit

Permalink
spelling and minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vcloarec authored and wonder-sk committed Jan 11, 2021
1 parent 7d8e8ba commit b9005cb
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
9 changes: 7 additions & 2 deletions src/providers/mssql/qgsmssqlconnection.cpp
Expand Up @@ -469,7 +469,7 @@ QList<QgsVectorDataProvider::NativeType> QgsMssqlConnection::nativeTypes()
;
}

QString QgsMssqlConnection::buildQueryForSchemas( const QString &connName )
QString QgsMssqlConnection::buildQueryForSchemas( const QString &connName, bool allowTablesWithNoGeometry )
{
QgsSettings settings;

Expand Down Expand Up @@ -524,7 +524,7 @@ QString QgsMssqlConnection::buildQueryForSchemas( const QString &connName )
query += QStringLiteral( " AND (sys.schemas.name IN %1)" ).arg( selectedSchemas );
}

if ( allowGeometrylessTables( connName ) )
if ( allowTablesWithNoGeometry )
{
query += QStringLiteral( "UNION ALL \n"
"SELECT sys.schemas.name, sys.objects.name, null, null, 'NONE', case when sys.objects.type = 'V' THEN 1 ELSE 0 END \n"
Expand All @@ -537,6 +537,11 @@ QString QgsMssqlConnection::buildQueryForSchemas( const QString &connName )
return query;
}

QString QgsMssqlConnection::buildQueryForSchemas( const QString &connName )
{
return buildQueryForSchemas( connName, allowGeometrylessTables( connName ) );
}

QString QgsMssqlConnection::dbConnectionName( const QString &name )
{
// Starting with Qt 5.11, sharing the same connection between threads is not allowed.
Expand Down
8 changes: 7 additions & 1 deletion src/providers/mssql/qgsmssqlconnection.h
Expand Up @@ -176,7 +176,13 @@ class QgsMssqlConnection
static QList<QgsVectorDataProvider::NativeType> nativeTypes();

/**
* Builds and returns a sql query string to obtain schemas list depending on settings
* Builds and returns a sql query string to obtain schemas list depending on settings and \a allowTablesWithNoGeometry
* \since QGIS 3.18
*/
static QString buildQueryForSchemas( const QString &connName, bool allowTablesWithNoGeometry );

/**
* Builds and returns a sql query string to obtain schemas list depending only on settings
* \since QGIS 3.18
*/
static QString buildQueryForSchemas( const QString &connName );
Expand Down
2 changes: 1 addition & 1 deletion src/providers/mssql/qgsmssqlnewconnection.cpp
Expand Up @@ -302,7 +302,7 @@ void QgsMssqlNewConnection::updateOkButtonState()

void QgsMssqlNewConnection::onCurrentDataBaseChange()
{
//Fisrt store the schema settings for the previous dataBase
//First store the schema settings for the previous dataBase
QVariantMap vm = mSchemaModel.schemasSettings();
if ( !mSchemaModel.dataBaseName().isEmpty() )
mSchemaSettings.insert( mSchemaModel.dataBaseName(), mSchemaModel.schemasSettings() );
Expand Down
6 changes: 3 additions & 3 deletions src/providers/mssql/qgsmssqlnewconnection.h
Expand Up @@ -51,7 +51,7 @@ class QgsMssqlNewConnection : public QDialog, private Ui::QgsMssqlNewConnectionB
void updateOkButtonState();
void onCurrentDataBaseChange();
private:
//! Class that reprents a model to display available schemas on a database and choose which will be diplayed in QGIS
//! Class that reprents a model to display available schemas on a database and choose which will be displayed in QGIS
class SchemaModel: public QAbstractListModel
{
public:
Expand All @@ -62,10 +62,10 @@ class QgsMssqlNewConnection : public QDialog, private Ui::QgsMssqlNewConnectionB
bool setData( const QModelIndex &index, const QVariant &value, int role ) override;
Qt::ItemFlags flags( const QModelIndex &index ) const override;

//! Sets the schema settings (keyd : schema names, value : bool that represnts wheter the schema is checked)
//! Sets the schema settings (keyd : schema names, value : bool that represents whether the schema is checked)
void setSchemasSetting( const QVariantMap &schemas );

//! Returns the schema settings (keyd : schema names, value : bool that represnts wheter the schema is checked)
//! Returns the schema settings (keyd : schema names, value : bool that represents whether the schema is checked)
QVariantMap schemasSettings() const;

//! Returns the database nale represented by the model
Expand Down
2 changes: 1 addition & 1 deletion src/providers/mssql/qgsmssqlsourceselect.cpp
Expand Up @@ -540,7 +540,7 @@ void QgsMssqlSourceSelect::btnConnect_clicked()
// Read supported layers from database
QApplication::setOverrideCursor( Qt::WaitCursor );

QString query = QgsMssqlConnection::buildQueryForSchemas( cmbConnections->currentText() );
QString query = QgsMssqlConnection::buildQueryForSchemas( cmbConnections->currentText(), allowGeometrylessTables );

// issue the sql query
q = QSqlQuery( db );
Expand Down

0 comments on commit b9005cb

Please sign in to comment.