Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MSSQL connection string backslash in "where" take 3 #59458

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Geojim
Copy link

@Geojim Geojim commented Nov 15, 2024

Fixes #59264

Handles backslashes in where statements for schemas like (Domain\User) throwing errors when adding table from MSSQL

@github-actions github-actions bot added this to the 3.42.0 milestone Nov 15, 2024
@Geojim Geojim changed the title Fix backslash in where take 3 Fix MSSQL connection string backslash in "where" take 3 Nov 19, 2024
@@ -436,15 +436,15 @@ QString QgsMssqlConnection::buildQueryForTables( bool allowTablesWithNoGeometry,
{
query += QLatin1String( "f_table_schema, f_table_name, f_geometry_column, srid, geometry_type, 0, coord_dimension FROM geometry_columns" );
if ( !notSelectedSchemas.isEmpty() )
query += QStringLiteral( " WHERE f_table_schema NOT IN %1" ).arg( notSelectedSchemas );
query += QStringLiteral( " WHERE QUOTENAME(f_table_schema) NOT IN %1" ).arg( notSelectedSchemas );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? To me it looks like we're comparing a quoted identifier (from QUOTENAME) vs a quoted value (from QgsMssqlProvider::quotedValue) in notSelectedSchemas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQL Server can't add layers from schema with '\' backslash in them
2 participants