25 QString QgsExecuteRegisteredSpatialiteQueryAlgorithm::name()
const
27 return QStringLiteral(
"spatialiteexecutesqlregistered" );
30 QString QgsExecuteRegisteredSpatialiteQueryAlgorithm::displayName()
const
32 return QObject::tr(
"SpatiaLite execute SQL (registered DB)" );
35 QStringList QgsExecuteRegisteredSpatialiteQueryAlgorithm::tags()
const
37 return QObject::tr(
"database,sql,spatialite,execute" ).split(
',' );
40 QString QgsExecuteRegisteredSpatialiteQueryAlgorithm::group()
const
42 return QObject::tr(
"Database" );
45 QString QgsExecuteRegisteredSpatialiteQueryAlgorithm::groupId()
const
47 return QStringLiteral(
"database" );
50 QString QgsExecuteRegisteredSpatialiteQueryAlgorithm::shortHelpString()
const
52 return QObject::tr(
"Executes a SQL command on a SpatiaLite database." );
55 QgsExecuteRegisteredSpatialiteQueryAlgorithm *QgsExecuteRegisteredSpatialiteQueryAlgorithm::createInstance()
const
57 return new QgsExecuteRegisteredSpatialiteQueryAlgorithm();
60 void QgsExecuteRegisteredSpatialiteQueryAlgorithm::initAlgorithm(
const QVariantMap & )
70 QString connName = parameterAsConnectionName( parameters, QStringLiteral(
"DATABASE" ), context );
72 std::unique_ptr<QgsAbstractDatabaseProviderConnection> conn;
80 throw QgsProcessingException( QObject::tr(
"Could not retrieve connection details for %1" ).arg( connName ) );
83 QString sql = parameterAsString( parameters, QStringLiteral(
"SQL" ), context ).replace(
'\n',
' ' );
86 conn->executeSql( sql );