Skip to content
Permalink
Browse files

spelling and minor fix

  • Loading branch information
vcloarec authored and wonder-sk committed Jan 11, 2021
1 parent 7d8e8ba commit b9005cbc2763edcc0b27df13b65423f6d0723d99
@@ -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;

@@ -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"
@@ -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.
@@ -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 );
@@ -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() );
@@ -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:
@@ -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
@@ -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 );

0 comments on commit b9005cb

Please sign in to comment.
You can’t perform that action at this time.