summaryrefslogtreecommitdiffstats
path: root/src/sql/models/qsqltablemodel_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* QSqlTableModel: expose methods for getting primary valuesMark Brand2013-04-021-3/+1
| | | | | | | These methods are very useful in subclasses. Change-Id: Ifdfee9d90cbdad97f349e46b587582f1d9e7cd7a Reviewed-by: Andy Shaw <andy.shaw@digia.com>
* QSqlTableModel: support refreshing inserted rows with auto columnsMark Brand2013-02-061-0/+1
| | | | | | | | | | | | | | | | | | Previously, selectRow() did not work after INSERTing a new row into a table with an automatically populated column. It did not work because the model did not know the primary values for the new row. Newly inserted rows were therefore not refreshed in OnFieldChange and OnRowChange edit strategies. This change provides support for the typical simple case where a single column is populated by the database and can be retrieved with QSqlQuery::lastInsertId(). Task-Number: QTBUG-29102 Change-Id: Ibf0f0ac8661185bde57034ddf40c2178bece4778 Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Lukas Geyer <lgeyer@gmx.at> Reviewed-by: Mark Brand <mabrand@mabrand.nl>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* fix #includesMark Brand2012-10-021-1/+2
| | | | | | Change-Id: Ia33d7ef08e43bad95d57823e37757a09e53493b9 Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* QSqlTableModel::selectRow(): fix failure on uncached rowsMark Brand2012-09-241-6/+2
| | | | | | | | | | | | | | | | | | | | This method was originally intended for refreshing rows after submitting changes. It should also work for refreshing rows that are unchanged (i.e., not cached), but did not because constructing the primary values depended on the cache. As a consequence, the WHERE clause for the query was not created. Fixed by deriving primary values for uncached rows from the query record. Note that the cache is still authoritative for rows it holds. This is important because the prmary values there may differ from the original query record due to changes to columns of the primary key. Includes new test. Change-Id: I41cca2cbf26019d4b495ffa6d876e2b55ec57803 Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Mark Brand <mabrand@mabrand.nl>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* QSql*Model: add SQL syntax helperMark Brand2012-03-221-0/+5
| | | | | Change-Id: Ia53e30d7a2f2bb5b4f76c32fcf0fe526d1e4ab51 Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
* QSqlTableModel bugfix: consider uncached rows submittedMark Brand2012-03-151-0/+2
| | | | | Change-Id: I7ec0529b88fd8e3ae0cf8dadfcb5899579e52745 Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
* QSqlTableModel: long live selectRow()!Mark Brand2012-03-071-0/+14
| | | | | Change-Id: If26dbcc8a1e8ef1376ef7a688c946ce5270e5706 Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
* QSqlTableModel: handle changes between submit and selectMark Brand2012-03-071-7/+40
| | | | | | | | | | | | | | | | | | | | Once an insert has been submitted, the cached record behaves like an update. For row bookkeeping, we still have to remember that it was originally inserted and is not in the query rows. Between submitting a delete and selecting, we remove the values from the deleted record. This causes a blank row to be displayed. Read-only flag is set for cells in deleted row. Reverting between submit and select means going back to the last submitted values. When removing rows, it's better to process from highest row numbers to lowest. This avoids complications with higher rows shifting down when lower rows are removed. Change-Id: I8752fa11f7a1b88f2a71b9e03a020ac37e62487f Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
* QSqlTableModel: derive primary values from database valuesMark Brand2012-03-061-0/+12
| | | | | | | | | | | Primary values are used to map a row in the model to a row in the database table. It is critically important between submitting a change and the following select (which refreshes the query) to have updated primary values. Otherwise, if the change affected the primary values, additional changes before select will misbehave. Change-Id: I5d08dd70ac5d3f06cd9d3186a439f4c80a037c2d Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
* QSqlTableModel: mirror database values in change cacheMark Brand2012-03-061-4/+8
| | | | | | | | | | | Between submitting and the next select, these values will be more up-to-date than those that could be obtained from the query. This will be useful for constructing primary values and reverting changes made after submitting. Change-Id: I8317617f3e7043ad0b79b333731c55fb88aef171 Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
* QSqlTableModel: remove unnecessary parameter from setSubmitted()Mark Brand2012-03-061-1/+1
| | | | | Change-Id: I6d23788163ffd6ba7a8f01ed40910d861ff92703 Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
* QSqlTableModel::submitAll(): avoid resubmiting successful changesMark Brand2012-02-151-1/+4
| | | | | | | | | | | | | | Consider what happens the 1st change succeeds and the 2nd fails. No select will be done. When submitAll() is called again, the 1st will still seem to be pending. It will fail or have unexpected effects if the primary values were changed. The solution is to avoid resubmitting successful changes. We leave them in the cache so they stay visible. Submitted changes cannot be reverted of course. Change-Id: Ibf400555effa1c3801d02f8713b4b69856ede23a Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
* QSqlTableModel: do not store primaryValues in change cacheMark Brand2012-02-151-4/+2
| | | | | | | They can be generated on demand regardless of edit strategy. Change-Id: I1e1853e93cc453f1486b65ce577f00141b9c5c47 Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
* QSqlTableModel: deduplicate and optimize counting of insertsMark Brand2012-02-151-0/+1
| | | | | | | | | Reading STL iteration code is painful enough if you only have to do it once. Thiago suggested remembering the end iterator for performance. Change-Id: Ic2cdc480f591932ea420e692a4d2796d49f05313 Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
* QSqlTableModel::primaryValues(): make constMark Brand2012-02-141-1/+1
| | | | | Change-Id: I6d53beb2b177dc5c71c74755f2fb602ab87502c0 Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
* QSqlTableModel: do not suppress dataChanged() on inserted recordMark Brand2012-02-081-1/+3
| | | | | | | | | | | | | | | | | | | Affects setData() and setRecord(). Previously dataChanged() was suppressed when editing an inserted record, except for OnManualSubmit. The motivation was probably to allow setData() to be used while handling primeInsert(). Suppressing dataChanged() is not a good idea since views other than the one which made the change will not know of the change. It is a terrible idea to call setData() or setRecord() while handling primeInsert(), so this is now expressly forbidden. setData() and setRecord() now do nothing and return false if called while rows are being inserted. Change-Id: I96738c09a6268704c5626d95b72bfb46378e3242 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* QSqlTableModelPrivate::ModifiedRow guard private dataMark Brand2012-02-071-9/+15
| | | | | | | | | | | | | | | | Even though ModifiedRow is not part of the public API, guarding its data helps make clear the intended patterns of use. "op" and "primaryValues" are read-only after construction. setValue() encourages maintainers to let ModifiedRow manage the "generated" flags of the record. The primeInsert() signal still exposes the actual record, including the "generated" flags, which is the justification for recRef(). Change-Id: I16d1610a8f9233af78b90662b08706b48ea19c41 Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
* QSqlTableModelPrivate: deduplicate field stripping logicMark Brand2012-02-071-0/+1
| | | | | Change-Id: Ic969a192644e84d78558da0f19e588033e4af43d Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
* merge private and public QSqlTableModel::setRecord()Mark Brand2012-02-051-1/+0
| | | | | Change-Id: I409bd32f85224db64363688d63fc372d1beaa0d3 Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
* ModifiedRow: use for all edit strategiesMark Brand2012-02-051-10/+6
| | | | | | | | | | | | Previously ModifiedRow was used only for OnManualSubmit and a seperate buffer and utility methods were used for OnFieldChange and OnRowChange. Also, initialization of the edit buffer is done by ModifiedRow instead of a helper function. Change-Id: I3316498e5bb10c416138ca14c3a7f8b143c8e544 Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | 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>
* improvements to ModifiedRowMark Brand2012-01-271-2/+7
| | | | | | | | | -remove unnecessary explicit copy constructor -explicitly inline constructor -more convenient initialization Change-Id: I78b275ef9d5413f95278a044345e42303dc35624 Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
* fix identation and styleMark Brand2012-01-271-1/+1
| | | | | | Change-Id: I18e9e752e8dc0cf980f424264f274177b98a98be Reviewed-by: Yunqiao Yin <charles.yin@nokia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | 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-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+120
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12