diff --git a/src/providers/spatialite/qgsspatialiteprovider.cpp b/src/providers/spatialite/qgsspatialiteprovider.cpp index 0dbb3dd3c5cd..88689bff1e84 100644 --- a/src/providers/spatialite/qgsspatialiteprovider.cpp +++ b/src/providers/spatialite/qgsspatialiteprovider.cpp @@ -5335,7 +5335,7 @@ QGISEXTERN bool saveStyle( const QString& uri, const QString& qmlStyle, const QS ") VALUES (" "%1,%2,%3,%4,%5,%6,%7,%8,%9,%10%12" ")" ) - .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.database() ) ) + .arg( QgsSpatiaLiteProvider::quotedValue( QString() ) ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.schema() ) ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.table() ) ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.geometryColumn() ) ) @@ -5350,12 +5350,10 @@ QGISEXTERN bool saveStyle( const QString& uri, const QString& qmlStyle, const QS QString checkQuery = QString( "SELECT styleName" " FROM layer_styles" - " WHERE f_table_catalog=%1" - " AND f_table_schema=%2" - " AND f_table_name=%3" - " AND f_geometry_column=%4" - " AND styleName=%5" ) - .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.database() ) ) + " WHERE f_table_schema=%1" + " AND f_table_name=%2" + " AND f_geometry_column=%3" + " AND styleName=%4" ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.schema() ) ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.table() ) ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.geometryColumn() ) ) @@ -5389,17 +5387,15 @@ QGISEXTERN bool saveStyle( const QString& uri, const QString& qmlStyle, const QS ",styleSLD=%3" ",description=%4" ",owner=%5" - " WHERE f_table_catalog=%6" - " AND f_table_schema=%7" - " AND f_table_name=%8" - " AND f_geometry_column=%9" - " AND styleName=%10" ) + " WHERE f_table_schema=%6" + " AND f_table_name=%7" + " AND f_geometry_column=%8" + " AND styleName=%9" ) .arg( useAsDefault ? "1" : "0" ) .arg( QgsSpatiaLiteProvider::quotedValue( qmlStyle ) ) .arg( QgsSpatiaLiteProvider::quotedValue( sldStyle ) ) .arg( QgsSpatiaLiteProvider::quotedValue( styleDescription.isEmpty() ? QDateTime::currentDateTime().toString() : styleDescription ) ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.username() ) ) - .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.database() ) ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.schema() ) ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.table() ) ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.geometryColumn() ) ) @@ -5410,11 +5406,9 @@ QGISEXTERN bool saveStyle( const QString& uri, const QString& qmlStyle, const QS { QString removeDefaultSql = QString( "UPDATE layer_styles" " SET useAsDefault=0" - " WHERE f_table_catalog=%1" - " AND f_table_schema=%2" - " AND f_table_name=%3" - " AND f_geometry_column=%4" ) - .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.database() ) ) + " WHERE f_table_schema=%1" + " AND f_table_name=%2" + " AND f_geometry_column=%3" ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.schema() ) ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.table() ) ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.geometryColumn() ) ); @@ -5457,13 +5451,11 @@ QGISEXTERN QString loadStyle( const QString& uri, QString& errCause ) QString selectQmlQuery = QString( "SELECT styleQML" " FROM layer_styles" - " WHERE f_table_catalog=%1" - " AND f_table_schema=%2" - " AND f_table_name=%3" - " AND f_geometry_column=%4" + " WHERE f_table_schema=%1" + " AND f_table_name=%2" + " AND f_geometry_column=%3" " ORDER BY CASE WHEN useAsDefault THEN 1 ELSE 2 END" ",update_time DESC LIMIT 1" ) - .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.database() ) ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.schema() ) ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.table() ) ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.geometryColumn() ) ); @@ -5540,11 +5532,9 @@ QGISEXTERN int listStyles( const QString &uri, QStringList &ids, QStringList &na // get them QString selectRelatedQuery = QString( "SELECT id,styleName,description" " FROM layer_styles" - " WHERE f_table_catalog=%1" - " AND f_table_schema=%2" - " AND f_table_name=%3" - " AND f_geometry_column=%4" ) - .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.database() ) ) + " WHERE f_table_schema=%1" + " AND f_table_name=%2" + " AND f_geometry_column=%3" ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.schema() ) ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.table() ) ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.geometryColumn() ) ); @@ -5569,9 +5559,8 @@ QGISEXTERN int listStyles( const QString &uri, QStringList &ids, QStringList &na QString selectOthersQuery = QString( "SELECT id,styleName,description" " FROM layer_styles" - " WHERE NOT (f_table_catalog=%1 AND f_table_schema=%2 AND f_table_name=%3 AND f_geometry_column=%4)" + " WHERE NOT (f_table_schema=%1 AND f_table_name=%2 AND f_geometry_column=%3)" " ORDER BY update_time DESC" ) - .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.database() ) ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.schema() ) ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.table() ) ) .arg( QgsSpatiaLiteProvider::quotedValue( dsUri.geometryColumn() ) );