Also disable the 'kexi' object as it is not ported.
Details
Diff Detail
- Repository
- R8 Calligra
- Branch
- kexi-reports-script-piggz
- Lint
No Linters Available - Unit
No Unit Test Coverage
Cool, minor notes.
I think we can remove use of ifdef KREPORT_SCRIPTING from Kexi.
Instead we can add a cmake-level check to ensure KREPORT_SCRIPTING is ON.
So if missing, it won't look like a bug in Kexi code.
Further task would be create an abstract interface for KRScriptFunctions in KReport and make KRScriptFunctions in Kexi implementing it. KReport's example can implement it in a limited way. Interested?
Later, the KRScriptFunctions' implementation could be part of a KReport-KDb lib.
kexi/plugins/reports/kexidbreportdata.cpp | ||
---|---|---|
313 | -> 0 == QString::compare(QString, Qt::CaseInsensitive) | |
363 | -> 0 == QString::compare(QString, Qt::CaseInsensitive) | |
kexi/plugins/reports/kexireportview.cpp | ||
35 | like above | |
171 | like above | |
407 | like above | |
kexi/plugins/reports/kexireportview.h | ||
37 | For all commented code let's use: so we either remove or port it later | |
79 | like above | |
kexi/plugins/reports/krscriptfunctions.cpp | ||
54 | How about using m_connection->querySingleString(KDbQuerySchema* query, QString* value)? |
kexi/plugins/reports/krscriptfunctions.cpp | ||
---|---|---|
54 | Done, but used querySingString(KDbEscapedString......) |
More comments...
kexi/plugins/CMakeLists.txt | ||
---|---|---|
2 ↗ | (On Diff #557) | |
kexi/plugins/reports/kexidbreportdata.cpp | ||
313 | Missing 2x "0 ==" | |
363 | Again, missing 2x "0 ==" | |
363 | Plus, it would make sense to have an internal (not exported) function and use it static bool isInterpreterSupported(const QString &interpreterName) | |
kexi/plugins/reports/kexidbreportdata.h | ||
73 | Consistency: script -> scriptname | |
kexi/plugins/reports/kexireportview.h | ||
79 | !todo -> ! @todo (in 3 places) | |
kexi/plugins/reports/krscriptfunctions.cpp | ||
48–53 | No need to initialize, QString().toReal() returns 0.0 too. | |
54 |
So how about adding a backlog here: //! @todo KEXI3 'function' is unsafe (SQL injection possible), we have no escaping for it, employ a function parser here | |
58 | "WHERE(" -> "WHERE (" | |
68 | space after , | |
70 | OK, just we have no error reporting e.g. for sqrt(-1.0), maybe add a todo? | |
122 | *i -> it | |
kexi/plugins/reports/krscriptfunctions.h | ||
50 ↗ | (On Diff #557) | Let's make it const |
kexi/plugins/reports/krscriptfunctions.h | ||
---|---|---|
29 ↗ | (On Diff #557) | Where's the file? |
kexi/plugins/CMakeLists.txt | ||
---|---|---|
2 ↗ | (On Diff #557) | Update: |
BTW, This report (see the XML below) crashes for me on preview:
<!DOCTYPE kexireport> <kexireport> <report:content xmlns:report="http://kexi-project.org/report/2.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"> <report:title>Report</report:title> <report:script report:script-interpreter="javascript"></report:script> <report:grid report:grid-divisions="4" report:grid-snap="1" report:page-unit="cm" report:grid-visible="1"/> <report:page-style report:print-orientation="portrait" fo:margin-bottom="28.346505799999999pt" fo:margin-top="28.346505799999999pt" fo:margin-left="28.346505799999999pt" fo:margin-right="28.346505799999999pt" report:page-size="A4">predefined</report:page-style> <report:body> <report:detail> <report:section svg:height="77.952890950006235pt" fo:background-color="#ffffff" report:section-type="detail"> <report:field report:item-data-source="=field.value("date")+"\n"+field.value("uptime")+"\n"+field.value("dns")+"\n"+field.value("connect")" report:name="field2" report:word-wrap="0" report:can-grow="1" report:horizontal-align="left" svg:x="7.086626450000000pt" svg:width="531.496983750085064pt" svg:y="7.086626450000000pt" report:vertical-align="center" svg:height="14.173252900002270pt" report:z-index="0"> <report:text-style fo:letter-spacing="0%" style:letter-kerning="true" fo:font-size="11" fo:foreground-color="#000000" fo:font-family="Nokia Pure Text" fo:background-color="#ffffff" fo:background-opacity="100%"/> <report:line-style report:line-style="nopen" report:line-weight="1" report:line-color="#000000"/> </report:field> </report:section> </report:detail> </report:body> </report:content> <connection type="internal" source="_160237"/> </kexireport>
Moving to first record..
org.kde.kreport.core: Added "section_detail" to report "_160237"
org.kde.kreport.core: Report name is "_160237"
ID: 127
"executable"
"" "script1"
org.kde.kreport.core: ""
ASSERT failure in QVector<T>::at: "index out of range", file /usr/include/qt5/QtCore/qvector.h, line 393
Aborted
#4 0x00007ffff2fd3cf1 in qt_assert_x(char const*, char const*, char const*, int) (where=<optimized out>, what=<optimized out>, file=<optimized out>, line=<optimized out>) at global/qglobal.cpp:2974 #5 0x00007fffd5af5f41 in QVector<KDbQueryColumnInfo*>::at(int) const (this=0x611b50, i=-1) at /usr/include/qt5/QtCore/qvector.h:393 #6 0x00007fffd5af4f91 in SqliteCursor::value(int) (this=0x6a4090, i=-1) at src/kdb/src/drivers/sqlite/SqliteCursor.cpp:336 #7 0x00007fffcd56c7e2 in KexiDBReportData::value(QString const&) const (this=0x791bc0, fld=...) at src/calligra-f/kexi/plugins/reports/kexidbreportdata.cpp:235 #8 0x00007fffcd4a5792 in KoReportPreRendererPrivate::renderSectionSize(KRSectionData const&) (this=0xc3afa0, sectionData=...) at src/kreport/src/renderer/KoReportPreRenderer.cpp:300 #9 0x00007fffcd4a4d78 in KoReportPreRendererPrivate::renderDetailSection(KRDetailSectionData*) (this=0xc3afa0, detailData=0x785730) at src/kreport/src/renderer/KoReportPreRenderer.cpp:190 #10 0x00007fffcd4a71b6 in KoReportPreRenderer::generate() (this=0x69d7c0) at src/kreport/src/renderer/KoReportPreRenderer.cpp:581 #11 0x00007fffcd568758 in KexiReportView::afterSwitchFrom(Kexi::ViewMode) (this=0xc37400, mode=Kexi::AllViewModes) at src/calligra-f/kexi/plugins/reports/kexireportview.cpp:415 #12 0x00007ffff7d87dae in KexiWindow::switchToViewMode(Kexi::ViewMode, QMap<QString, QVariant>*, bool*) (this=0x75dac0, newViewMode=Kexi::DataViewMode, staticObjectArgs=0x0, proposeOpeningInTextViewModeBecauseOfProblems=0x7fffffffb42f) at src/calligra-f/kexi/core/KexiWindow.cpp:541 #13 0x00007ffff7d9876c in KexiPart::Part::openInstance(QWidget*, KexiPart::Item*, Kexi::ViewMode, QMap<QString, QVariant>*) (this=0x766760, parent=0x78dd70, item=0x5c5b60, viewMode=Kexi::DataViewMode, staticObjectArgs=0x0) at src/calligra-f/kexi/core/kexipart.cpp:281
@adam I'll push this code (with minimal proposed fixes). W need the kexi-frameworks9-staniek branch in a compleable state because merge with master is close.
I fixed the above crash this way:
QVariant KexiDBReportData::value ( const QString &fld ) const { int i = fieldNumber ( fld ); - if ( d->cursor ) + if (d->cursor && i >= 0) return d->cursor->value ( i ); return QVariant(); }
Moreover added a check for i < 0 in SqliteCursor::value() (Kdb).