Changeset View
Changeset View
Standalone View
Standalone View
kexi/plugins/reports/krscriptfunctions.cpp
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | * Kexi Report Plugin | 2 | * Kexi Report Plugin | ||
3 | * Copyright (C) 2007-2008 by Adam Pigg <adam@piggz.co.uk> | 3 | * Copyright (C) 2007-2008 by Adam Pigg <adam@piggz.co.uk> | ||
4 | * Copyright (C) 2012 Jarosław Staniek <staniek@kde.org> | 4 | * Copyright (C) 2012-2016 Jarosław Staniek <staniek@kde.org> | ||
5 | * | 5 | * | ||
6 | * This library is free software; you can redistribute it and/or | 6 | * This library is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU Lesser General Public | 7 | * modify it under the terms of the GNU Lesser General Public | ||
8 | * License as published by the Free Software Foundation; either | 8 | * License as published by the Free Software Foundation; either | ||
9 | * version 2.1 of the License, or (at your option) any later version. | 9 | * version 2.1 of the License, or (at your option) any later version. | ||
10 | * | 10 | * | ||
11 | * This library is distributed in the hope that it will be useful, | 11 | * This library is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * Lesser General Public License for more details. | 14 | * Lesser General Public License for more details. | ||
15 | * | 15 | * | ||
16 | * You should have received a copy of the GNU Lesser General Public | 16 | * You should have received a copy of the GNU Lesser General Public | ||
17 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | 17 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
18 | */ | 18 | */ | ||
19 | #include "krscriptfunctions.h" | 19 | #include "krscriptfunctions.h" | ||
20 | #include <db/cursor.h> | 20 | #include <db/cursor.h> | ||
21 | #include <db/utils.h> | 21 | #include <db/utils.h> | ||
22 | #include <kdebug.h> | 22 | #include <kdebug.h> | ||
23 | 23 | | |||
24 | KRScriptFunctions::KRScriptFunctions(const KoReportData* kodata, KexiDB::Connection* conn) | 24 | KRScriptFunctions::KRScriptFunctions(const KoReportData* kodata, KexiDB::Connection* conn) | ||
25 | { | 25 | { | ||
26 | m_cursor = kodata; | 26 | m_cursor = kodata; | ||
27 | m_connection = conn; | 27 | m_connection = conn; | ||
28 | 28 | | |||
29 | if (kodata->sourceClass().isEmpty() || kodata->sourceClass() == "org.kexi-project.table") { | ||||
29 | if (m_connection->tableSchema(kodata->sourceName())) { | 30 | if (m_connection->tableSchema(kodata->sourceName())) { | ||
30 | m_source = kodata->sourceName(); | 31 | m_source = kodata->sourceName(); | ||
31 | } else if (m_connection->querySchema(kodata->sourceName())) { | 32 | } | ||
33 | } | ||||
34 | if (m_source.isEmpty() && (kodata->sourceClass().isEmpty() || kodata->sourceClass() == "org.kexi-project.query")) { | ||||
35 | if (m_connection->querySchema(kodata->sourceName())) { | ||||
32 | m_source = m_connection->selectStatement(*(m_connection->querySchema(kodata->sourceName()))); | 36 | m_source = m_connection->selectStatement(*(m_connection->querySchema(kodata->sourceName()))); | ||
33 | } | 37 | } | ||
34 | } | 38 | } | ||
39 | } | ||||
35 | 40 | | |||
36 | KRScriptFunctions::~KRScriptFunctions() | 41 | KRScriptFunctions::~KRScriptFunctions() | ||
37 | { | 42 | { | ||
38 | } | 43 | } | ||
39 | 44 | | |||
40 | void KRScriptFunctions::setWhere(const QString&w) | 45 | void KRScriptFunctions::setWhere(const QString&w) | ||
41 | { | 46 | { | ||
42 | m_where = w; | 47 | m_where = w; | ||
▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines |