25 QString QgsExecutePostgisQueryAlgorithm::name()
const
27 return QStringLiteral(
"postgisexecutesql" );
30 QString QgsExecutePostgisQueryAlgorithm::displayName()
const
32 return QObject::tr(
"PostgreSQL execute SQL" );
35 QStringList QgsExecutePostgisQueryAlgorithm::tags()
const
37 return QObject::tr(
"database,sql,postgresql,postgis,execute" ).split(
',' );
40 QString QgsExecutePostgisQueryAlgorithm::group()
const
42 return QObject::tr(
"Database" );
45 QString QgsExecutePostgisQueryAlgorithm::groupId()
const
47 return QStringLiteral(
"database" );
50 QString QgsExecutePostgisQueryAlgorithm::shortHelpString()
const
52 return QObject::tr(
"Executes a SQL command on a PostgreSQL database." );
55 QgsExecutePostgisQueryAlgorithm *QgsExecutePostgisQueryAlgorithm::createInstance()
const
57 return new QgsExecutePostgisQueryAlgorithm();
60 void QgsExecutePostgisQueryAlgorithm::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 );
The QgsAbstractDatabaseProviderConnection class provides common functionality for DB based connection...
Contains information about the context in which a processing algorithm is executed.
Custom exception class for processing related exceptions.
Base class for providing feedback from a processing algorithm.
A data provider connection parameter for processing algorithms, allowing users to select from availab...
A string parameter for processing algorithms.
Custom exception class for provider connection related exceptions.
static QgsProviderRegistry * instance(const QString &pluginPath=QString())
Means of accessing canonical single instance.
QgsProviderMetadata * providerMetadata(const QString &providerKey) const
Returns metadata of the provider or nullptr if not found.