summaryrefslogtreecommitdiffstats
path: root/tests/auto/sql
Commit message (Collapse)AuthorAgeFilesLines
* QSqlTableModel::setRecord(): emit dataChanged() consistentlyMark Brand2012-02-081-3/+3
| | | | | | | | | | | | | | | Previously, if any fields in the supplied record could not be matched with a column in the target table, dataChanged() was supressed for all columns for OnManualSubmit. This is not good because it prevents other views from noticing the fields that *do* change. It's simplest and probably more efficient just to emit dataChanged() once for the whole row. Fewer signals need to be processed and in typical cases much or all of the row is likely to be changed anyway. Change-Id: Ib56bf9a18e51b9cb85771acefcb2bf26e295a54e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* QSqlTableModel::setRecord(): do not try to detect value changesMark Brand2012-02-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | In an apparent attempt to be economical with emitting dataChanged() and submitting SQL to the databse, setRecord() compares each field value of the record with the old value, taking action only when a difference is detected. Several complaints against this code are: -The comparision does not work on float type. -It is really up to the application and database to decide this. The model should make few assumptions. The application has the option to omit fields from the record that should be ignored. -The current behavior seems to assume that the "old" values are the current state of the database, but the database may have changed since the model was last refreshed. -The code compares the value from record(), which probably corresponds to the EditRole, with the DisplayRole value from data(). Change-Id: I11477c185eb411d442144dc682893d0df12d03d5 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* QSqlTableModel::removeRows(): don't emit extra beforeDeleteMark Brand2012-02-071-4/+3
| | | | | | | | Qt 5 seems like a welcome opportunity to stop emitting this spurious beforeDelete signal. Change-Id: Ib8628343ca9b8fdd85c154a206c7e2bf2c4c9dc1 Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
* Handle the 'real' datatype correctly in the SQLite driverAndy Shaw2012-02-032-1/+31
| | | | | | | | | | | | | | | The 'real' datatype should be seen as a QVariant::Double type and not as a QVariant::String type otherwise it does not get presented correctly when using a non Qt application to access it. Test is included for QSqlQuery. Task-number: QTBUG-16373 Change-Id: Ie323ce49eb95e4d6bb4c3814ba9a957a63f4b259 Reviewed-by: Yunqiao Yin <charles.yin@nokia.com> (cherry picked from commit b23631015c23a49e3b4d296ea0a6266bfce3d4f1) Reviewed-by: Mark Brand <mabrand@mabrand.nl>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-3012-12/+12
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-2312-12/+12
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-0512-12/+12
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Check driver validity before using itHonglei Zhang2011-12-121-2/+7
| | | | | | | | | | | | Even though it is stated in the documentation that the SQL driver must remain valid during the life time of QSqlQuery, there are users who don't follow the rule. It's common that the destructor of QSqlQuery is called after the driver is already deleted. This fix checks the validity of the SQLite driver before QSqliteResult uses it in destructor. Task-number: QTBUG-16967 Change-Id: If0f52113f12e14102da1671cd6e12bdaa267114f Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
* Remove TESTED_CLASS/TESTED_FILES comments from tests.Jason McDonald2011-12-0610-35/+0
| | | | | | | | | These comments were mostly empty or inaccurate. Appropriate naming of tests and appropriate placement of tests within the directory tree provide more reliable indicators of what is being tested. Change-Id: Ib6bf373d9e79917e4ab1417ee5c1264a2c2d7027 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fix tst_qsql crashes on Mac OS XHonglei Zhang2011-12-022-13/+15
| | | | | | | | | | | | In tst_qsql, there are function calls to QApplication(argc, 0, false), where argc is zero. According to the documentation, argc must be greater than zero and argv must contain at least one valid character string. The misuse of this API has no problem on any platform other than Mac OS. This commit has fixed the crash by passing valid dummy parameters. Task-number: QTBUG-22811 Change-Id: I42b26d66f0becb7a942896e6ddcaea52ff720a48 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* QSqlRelationalTableModel doesn't follow relations on the first columnHonglei Zhang2011-12-021-0/+55
| | | | | | | | | | QSqlRelationalTableModel doesn't follow relations on the first column of a table. The DisplayRole and the EditRole for indexes on column 0 are always the same. The bug is found in QSqlRelationalTableModel::data. Task-number: QTBUG-20038 Change-Id: Ie1e98b5f46ffc171113f2d51b9b19ff5febb1c3c Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
* Fix sqlite driver memory eating due to close failureHonglei Zhang2011-11-301-0/+49
| | | | | | | | | | | | | | If an ongoing query is not finalized before close function is called, sqlite driver still tries to close the connection to sqlite. In this case, sqlite reports an error to sqlite driver which is not reported to the client. The failure in close causes connection to sqlite unclosed and memory is not freed. This fix tries to finalize all queries before close function is called. The close function should succeed. Task-number: QTBUG-16967 Change-Id: I2f10a2a9017446a9d44b693b00464a89625e3602 Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
* SQLite support only one statement at a timeHonglei Zhang2011-11-231-0/+47
| | | | | | | | | | | SQLite driver support only one statement at a time. This fix makes the exec and prepare call failed if more than one statements are given. This is bug fix for QTBUG-21884. Also the behaviour is documented in the API specification. Task-number: QTBUG-21884 Change-Id: If1e25a0dd9f9ee38961ef478fc7909f6b05e360a Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
* Re-enable the sql autotests on Mac OS XBradley T. Hughes2011-11-211-0/+1
| | | | | | | | | The QSql test currently crashes, which can destabilize the CI system when attempting to re-enable the autotest. Skip this test for now by disabling the check target for it. Change-Id: I598f8ca7bce6b6f46daf6a053da5571b62486463 Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
* Fix QtSQL auto test server addressesHonglei Zhang2011-10-251-2/+8
| | | | | | | | | Fix QtSQL aoto test server addresses. New servers are located in Brisbane. Old Oslo test servers shall not be used anymore. Change-Id: Icd4ae4c0193f71410d572bfa014272e1e77586c0 Reviewed-by: Trust Me Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
* all remaining tests: eliminated usage of qttest_p4.prfRohan McGovern2011-10-2510-20/+30
| | | | | | | | | qttest_p4.prf was added as a convenience for Qt's own autotests in Qt4. It enables various crufty undocumented magic, of dubious value. Stop using it, and explicitly enable the things from it which we want. Change-Id: I02fe27b2c1800f929250fa8694ca2976c9661a12 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* test: Split `qsqlquery' unit and benchmark testSergio Ahumada2011-10-232-39/+4
| | | | | | | | | | | | | Moving benchmark test from 'tests/auto' to 'tests/benchmarks'. Also removing 'qttest_p4' usage while we are at it. - void benchmark(); was moved to 'tests/benchmarks/sql/kernel/qsqlquery' Task-number: QTQAINFRA-353 Change-Id: I241bb1a2fba1c1b5524c21e5941a6c5daf5a4a89 Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
* Remove SkipMode parameter from QSKIP calls.Jason McDonald2011-10-219-90/+90
| | | | | | | | | The previous commit removed SkipMode from the testlib APi. This commit removes the parameter from all calls to QSKIP. Task-number: QTBUG-21851, QTBUG-21652 Change-Id: I21c0ee6731c1bc6ac6d962590d9b31d7459dfbc5 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Move the non-atomic and implicit functions from QBasicAtomicXXXThiago Macieira2011-10-201-1/+1
| | | | | | | | | Now, users of QBasicAtomicInt and QBasicAtomicPointer must be sure to use .load() and .store() to access the values. Change-Id: I6b48ed175618baf387dd38d821bd50e6e93c082e Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove DEPENDS_ON from qtestlib API.Jason McDonald2011-10-191-6/+0
| | | | | | | | | | The DEPENDS_ON macro didn't do anything and has misled many users to think that they can write test functions that depend on other test functions. Task-number: QTBUG-21851 Change-Id: Ibe65b2d5d88bb81b6a0ebbe0b220f7d409a1446c Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove redundant qWarning's.Jason McDonald2011-10-072-6/+2
| | | | | | | | | | The removed warnings just repeat information that is already in the QSKIP's that immediately follow the warnings. Change-Id: Id13158487e8075aab8a8f48955303edde3f4af63 Reviewed-on: http://codereview.qt-project.org/6194 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* No need to return after QSKIP.Jason McDonald2011-10-073-31/+12
| | | | | | | | | QSKIP already causes the test function that calls it to return, so the returns removed by this commit were unreachable. Change-Id: I1fa2f3a3271927d8a600b02d8b31bd81db9146b1 Reviewed-on: http://codereview.qt-project.org/6188 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Tidy qsqldatabase autotestJason McDonald2011-10-061-39/+18
| | | | | | | | | Remove unused macro and remove redundant returns after calls to QSKIP. Change-Id: Ie333801cbec6c3123931f2fedbcd8902cab69a2e Reviewed-on: http://codereview.qt-project.org/6021 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove Symbian-specific code from tests.Jason McDonald2011-09-2911-115/+2
| | | | | | | | | Symbian is not a supported platform for Qt5, so this code is no longer required. Change-Id: I1172e6a42d518490e63e9599bf10579df08259aa Reviewed-on: http://codereview.qt-project.org/5657 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fix autotest gui/widgets dependenciesKent Hansen2011-09-197-6/+7
| | | | | | | | | | | | | | | | | This is in preparation of removing testlib's dependency on QtGui and QtWidgets. Autotests that need QtWidgets api must explicitly include it (since the types are no longer provided by the QtGui master header). Autotests that don't need QtGui or QtWidgets api shouldn't link against those libraries. Change-Id: I2808289068514fcac582808828ad4634e2631733 Reviewed-on: http://codereview.qt-project.org/5093 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Moved sql autotests into new directory structureJo Asplin2011-09-0637-0/+11910
Task-number: QTBUG-21253 Change-Id: Id20605e1247b080e775968b56ea5f56462ca4c71 Reviewed-on: http://codereview.qt.nokia.com/4127 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>