[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kexi/D15438] src/plugins/reports: Support params in report queries
From: Jaroslaw Staniek <null () kde ! org>
Date: 2018-09-12 8:40:01
Message-ID: E1g00gr-0005gH-Tg () code ! kde ! org
[Download RAW message or body]
Git commit 892b4912d67e646356d3c368546dfb1f99f59b13 by Jaroslaw Staniek, on behalf of \
Adam Pigg. Committed on 11/09/2018 at 22:08.
Pushed by staniek into branch 'D15438'.
Support params in report queries
Summary:
Prompt for parameters in queries that use them
Quite a small change. Minor issues exist:
1. When opening in design view, the data source is opened and therefore the \
parameters are prompted for (twice)
Bug: https://bugs.kde.org/show_bug.cgi?id=379694
Test Plan: Open a report using paramters, ensure they are prompted for, and ensure \
they are used correctly
Reviewers: staniek
Subscribers: Kexi-Devel-list
Tags: #kexi
Differential Revision: https://phabricator.kde.org/D15438
M +13 -3 src/plugins/reports/KexiDBReportDataSource.cpp
https://commits.kde.org/kexi/892b4912d67e646356d3c368546dfb1f99f59b13
diff --git a/src/plugins/reports/KexiDBReportDataSource.cpp \
b/src/plugins/reports/KexiDBReportDataSource.cpp index fdeddbc47..4bea737ad 100644
--- a/src/plugins/reports/KexiDBReportDataSource.cpp
+++ b/src/plugins/reports/KexiDBReportDataSource.cpp
@@ -19,6 +19,8 @@
#include "KexiDBReportDataSource.h"
#include "kexireportpart.h"
+#include <kexiutils/utils.h>
+#include <kexiqueryparameters.h>
#include <KDbConnection>
#include <KDbOrderByColumn>
@@ -49,6 +51,7 @@ public:
KDbQuerySchema *originalSchema;
KDbQuerySchema *copySchema;
KDbEscapedString schemaSql;
+ QList<QVariant> currentParams;
};
KexiDBReportDataSource::KexiDBReportDataSource(const QString &objectName, const \
QString &pluginId, @@ -120,9 +123,9 @@ bool KexiDBReportDataSource::open()
}
else if ( d->copySchema)
{
- qDebug() << "Opening cursor.."
- << KDbConnectionAndQuerySchema(d->tempData->connection(), \
*d->copySchema);
- d->cursor = d->tempData->connection()->executeQuery(d->copySchema, \
KDbCursor::Option::Buffered); + //qDebug() << "Opening cursor.."
+ // << KDbConnectionAndQuerySchema(d->tempData->connection(), \
*d->copySchema); + d->cursor = \
d->tempData->connection()->executeQuery(d->copySchema, d->currentParams, \
KDbCursor::Option::Buffered); }
@@ -171,6 +174,13 @@ bool KexiDBReportDataSource::getSchema(const QString& pluginId)
qDebug() << d->objectName << "is a query..";
qDebug() << KDbConnectionAndQuerySchema(d->tempData->connection(), \
*query);
d->originalSchema = new KDbQuerySchema(*query, \
d->tempData->connection()); +
+ bool ok;
+ KexiUtils::WaitCursorRemover remover;
+ d->currentParams = KexiQueryParameters::getParameters(0, \
d->tempData->connection(), d->originalSchema, &ok); + if (!ok) {
+ return false;
+ }
}
if (d->originalSchema) {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic