summaryrefslogtreecommitdiffstats
path: root/src/sql
Commit message (Collapse)AuthorAgeFilesLines
* Enable the "#include <QSql>" camel-case header, for the QSql namespaceSze Howe Koh2012-10-271-1/+0
| | | | | | | | | | | | | | | | | | The sync.profile Perl script will now generate the "QSql" header file during compilation. By removing the \inheaderfile command, the documentation will now display the namespace's own name as the header (i.e. "QSql" in this case). Previously, the only documented way to include the namespace was to include the whole module, which is expensive. This change also makes QSql consistent with other namespaces, such as QSsl and QAudio, which have their own dedicated camel-case headers. Part of the Header Consistency Project (http://lists.qt-project.org/pipermail/development/2012-October/007421.html) Change-Id: Ibb82d442956e767c13b82f1e552aabdf2e8ff110 Reviewed-by: Mark Brand <mabrand@mabrand.nl>
* QSqlRelationalDelegate: remove setEditorData reimplementationMark Brand2012-10-261-11/+0
| | | | | | | | | Since commit 84787d82ee9369b2a83c5b0568ee62ab602a5528 QItemDelegate::setEditorData() works out of the box on QComboBox. Change-Id: Ic9839f7eccccbdb787ce204fe98311335ee16b92 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Doc: Fix small capitalization error for the Qt SQL module header.Sze Howe Koh2012-10-221-1/+1
| | | | | | | The header file is named QtSql, not QtSQL. Change-Id: Ia3634c80d73f04fd27256f392cfed2068eeb9bc5 Reviewed-by: Mark Brand <mabrand@mabrand.nl>
* remove explicit load(qt_build_config)s from the librariesOswald Buddenhagen2012-10-191-2/+0
| | | | | | | .qmake.conf (and previously .qmake.cache) already does that for us. Change-Id: I06cc01fa45921d7bd66dda7a0f88729faeff37bd Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* QtSql: Correct documented default precision policy.Mark Brand2012-10-151-8/+4
| | | | | | | | Follow-up to commit c9f77564df14f91276e9ca693a9b3f339dab9334 Task-number: QTBUG-27482 Change-Id: I17c12ee14d4609bccbe67bba2581f13d72c069ae Reviewed-by: Mark Brand <mabrand@mabrand.nl>
* correct spelling in QtSql documentationMark Brand2012-10-151-1/+1
| | | | | | Change-Id: I69e4178bbe967a70b1141122639883b5cbacd924 Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Bill King <bill.king@nokia.com>
* QSqlTableModel: let select() and selectRow() be slotsMark Brand2012-10-141-3/+3
| | | | | | | | | It's convenient to be able to connect a button to select() and signals that provide a row to selectRow(). Change-Id: I520d5564943f679ec9e68331878a211dd52b4a06 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: David Faure <david.faure@kdab.com>
* Modularize documenation buildTor Arne Vestbø2012-10-102-6/+4
| | | | | | | | | | qdocconf files can now reference $QT_INSTALL_DOCS to pick up e.g. global includes, instead of using relative paths. Qt modules will automatically get a doc target that builds and installs into the right place (including supporting shadow-builds) if they set QMAKE_DOCS before loading(qt_module). Change-Id: Ia408385199e56e3ead0afa45645a059d1a8b0d48 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* QSqlQuery::value string overloadThiago A. Correa2012-10-082-0/+19
| | | | | | | | | | Introduce value overload to take field name as a parameter. This allows for terser application code that avoids explicit calls to QSqlRecord::value(). Change-Id: I02b6712cd5ec41633b902714315b5716c17d1a9b Reviewed-by: Mark Brand <mabrand@mabrand.nl>
* Fix QSqlQuery::value to use proper index checkThiago A. Correa2012-10-051-1/+1
| | | | | | | | Change the validation of index parameter to use -1 constant instead of QSql::BeforeFirstRow which is unrelated to field index Change-Id: I43b42bc7ce717bcd9ddc987d2e716f1672c00775 Reviewed-by: Mark Brand <mabrand@mabrand.nl>
* Qt SQL: Cleaned up documentation group membership and brief desc.Jerome Pasion2012-10-051-5/+6
| | | | | | Task-number: QTBUG-27449 Change-Id: I052c7c9beab344e6c0902f9440c1d6b74e15b0b6 Reviewed-by: Geir Vattekar <geir.vattekar@digia.com>
* QSqlTableModel::selectRow(): don't expand cache if there is no changeMark Brand2012-10-051-4/+26
| | | | | | | | Test added. Change-Id: Ibd72ef2aeee482abbd22991573460e55dc577457 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: David Faure (fixes for KDE) <faure@kde.org>
* QSqlTableModel: record(row) must use virtual data()Mark Brand2012-10-051-3/+11
| | | | | | | | | | | | | | Commit fbf010a26617b3986e9a76bd9c004403aebfcdc2 introduced a version of record(row) that includes the generated flags, but it neglected to populate the values using virtual data() as QSqlQueryModel correctly does. Test included lest we forget again. Change-Id: I49d0f8f87cd0c5078aa6a0e8373b2cffc01f2387 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QSqlTableModel: restore use of virtual setData() in setRecord()Mark Brand2012-10-051-5/+7
| | | | | | | | | | | | | | | | setRecord() should use setData() as intended so that reimplementations of setData() in subclasses will be respected. Commit 11bd543d901f67f79db3f5b5dfaa626c6e8faa45 failed to consider this. Test added which should prevent this mistake being repeated. Change-Id: Ia2d930cd42b5a27521bb389edb1b07fb1bf0fa36 Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Mark Brand <mabrand@mabrand.nl>
* QSqlTableModel: don't cache unchanged value in setData()Mark Brand2012-10-051-0/+6
| | | | | | | | | | | | | | | | | | | | | | This is good for performance in terms of avoiding unnecessary database activity and keeping the cache smaller. Detail: This change was not included in the big refactoring of QSqlTM. The idea was that the model shouldn't second guess the intention of the application and maybe the application wants to cause a submit. It was a marginal consideration. Now I think it's clear that our interest in not unnecessarily expanding the cache outweighs that. In addition, applications can now call selectRow() if they worry that the database values for the row have changed and want to set a value back again. Test added. Change-Id: I63814dcb63a96c6ba1c8cc227807725a954a0b68 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: David Faure <david.faure@kdab.com>
* QSqlTableModel: fix segfault when overriding selectRow()Mark Brand2012-10-051-9/+14
| | | | | | | | | | | | | | | | | The STL-style iteration over the cache in submitAll() assumed the iterator would remain valid until reaching cache.end(). This failed to consider that virtual selectRow() might be overridden so that it removes rows from the cache. For example, it might call select() which would empty the cache. The new approach checks at each iteration whether the row is still in the cache. Using foreach here is justified by its fitness for purpose and readability. New test included. Change-Id: Idee8807ede239c3ba56ff1604574c49f47385ad2 Reviewed-by: David Faure (fixes for KDE) <faure@kde.org>
* 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>
* fix indentationMark Brand2012-09-281-3/+3
| | | | | Change-Id: Iebec20c1be5a0610007a8e7ffd2646bda7f2785d Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Remove duplicate words and punctuation from documentation.Mitch Curtis2012-09-261-1/+1
| | | | | Change-Id: I5550c62d412510bc2c5acceb2cae7d2f2ef6a8d3 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* fix incorrect uses of qmake in documentationJoerg Bornemann2012-09-252-6/+6
| | | | | | | | | Assigning backslashes to qmake variables yields a warning these days. Use forward slashes as they get automatically converted. Task-number: QTBUG-27325 Change-Id: I804fa641064ce183e9794026ad1dbc91725d334d Reviewed-by: Mark Brand <mabrand@mabrand.nl>
* QSqlTableMode::selectRow(): lack of WHERE clause is an errorMark Brand2012-09-241-1/+9
| | | | | | | | | Since we only want one row, never ever run a SELECT without a WHERE clause. Change-Id: I40a78935f5573111faa3922eae97e6d5961be5f2 Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Mark Brand <mabrand@mabrand.nl>
* QSqlTableModel::selectRow(): reduce scope of QSqlQueryMark Brand2012-09-241-6/+8
| | | | | | | | | | It's good to clean up the query before emitting signals about the updated row. It's possible that connected slots will call selectRow() again for other rows. Change-Id: I482fe2dd58218f53567ce8725ee591ce2eeda348 Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Mark Brand <mabrand@mabrand.nl>
* QSqlTableModel::selectRow(): fix failure on uncached rowsMark Brand2012-09-242-7/+21
| | | | | | | | | | | | | | | | | | | | 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-2265-1330/+1330
| | | | | | | | 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>
* Move opengl/wid/net example docs to proper folders.Frederik Gladhorn2012-09-211-4/+4
| | | | | | Change-Id: I846439a9cf7ad965ed27a00f98dbc4ff97abe73b Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Martin Smith <martin.smith@digia.com>
* remove mentions of borland from project filesOswald Buddenhagen2012-09-194-7/+3
| | | | | Change-Id: I3049b24ae287bee50aca1de06664a2309df69edf Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* sql: Include own headers firstSergio Ahumada2012-09-193-5/+5
| | | | | | | | cpp files should include their own headers first (but below config.h) Change-Id: I225bc0f09988167ae7f938f7f21a77d05a3d191b Reviewed-by: Caroline Chao <caroline.chao@digia.com> Reviewed-by: Mark Brand <mabrand@mabrand.nl>
* Do not include /examples in qdocconfs.Frederik Gladhorn2012-09-111-1/+1
| | | | | Change-Id: I84a925a8be4964fae667f5a2500157283a8057d2 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Doc: Centralize more common settings in 1 global qdocconf.Casper van Donderen2012-09-111-36/+1
| | | | | | | | | | All qdocconf settings that should be used by all Qt modules are now in qt-module-defaults.qdocconf. Change-Id: I2a0315a55db3fcbb0160c4392d2da98611043d83 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com> Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Check for C++ operators that should be 'const'Sergio Ahumada2012-09-082-4/+4
| | | | | | | | Make sure all C++ class comparison operators are const. Change-Id: Ib4a66f2afe6c62f437dae1ecde94287d3db8442d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: David Faure <faure@kde.org>
* Use QStringList::join(QChar) overload where applicable [QtSql]Marc Mutz2012-09-032-2/+2
| | | | | | | | | | | This is an automated change performing the following replacements: join\("(.)"\) -> join('\1') join\(QLatin1String\("(.)"\)\) -> join(QLatin1Char('\1')) join\(QStringLiteral\("(.)"\)\) -> join(QLatin1Char('\1')) Change-Id: Ie395d82d17710683968d006d22de313ef49dc6e5 Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com> Reviewed-by: Mark Brand <mabrand@mabrand.nl>
* Doc: Fix docbuild when not using -developer-build.Casper van Donderen2012-09-011-2/+2
| | | | | | | | https://codereview.qt-project.org/#change,33974 only works in the case of a developer build. Not in a normal prefix build. Change-Id: I3a3e5029cefaa9f83c5deb71665f0efa9d812819 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
* Doc: Simplify qtbase qdocconfs.Casper van Donderen2012-08-311-15/+2
| | | | | | | | | | We should be using the global qdocconf for the common variables. This change also allows you to just specify -installdir without using a templatedir. Change-Id: I207d279d9b5199212e896fc5ccab5c212b1896c6 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
* QSqlQueryModel: suppress insert and remove signals while resettingMark Brand2012-08-302-4/+86
| | | | | | | | | | There is no need to emit signals for inserting and removing rows and columns while resetting the model. Suppress these signals in such a way that subclasses can benefit without worrying about it. Change-Id: I04447c87173be54a7323b97608cdd40ae245b80b Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QSqlQueryModel: fix nested beginResetModel/endResetModelMark Brand2012-08-302-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow-up to 83c9ebbd6692cde99ee692e6549c591100f12545. Consider the case where calls to the reset methods on the same object are nested as in the following sequence: 1. beginResetModel() 2. beginResetModel() 3. endResetModel() 4. endResetModel() In such cases, only the outermost calls, i.e., 1) and 4), should emit signals. After 83c9ebbd6692cde99ee692e6549c591100f12545, 1) and 3) emitted the signals, which is wrong. This is corrected by keeping track of the nesting level. Such sequences can come about when a base class calls the begin/end methods between the calls made by the subclass. QSqlTableModel::select() is an example of this. Test included. Change-Id: Ia62b45cb1abaab00a32bb8357de4a958bcff83e5 Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* docs: remove \reimp from non-virtual methodsMark Brand2012-08-302-3/+2
| | | | | | | It seems we need \internal in this case. Change-Id: I3f290bb0d22f9f3b5d04d27b13a7ef8961b2dd6c Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Exclude the examples/widgets/doc dir for all but widgets.Frederik Gladhorn2012-08-291-0/+2
| | | | | | | | There are too many references to the QWidget lib documentation in there. On the other hand this keeps snippets working. Change-Id: I7dd63b7fba1758accea2663f7b427940a8857e32 Reviewed-by: Martin Smith <martin.smith@nokia.com>
* documentation: grammar nitpickMark Brand2012-08-291-3/+3
| | | | | | Change-Id: Ibf16731f04f2c53adeff1b8b1fcc6f1555e3613d Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Bill King <bill.king@nokia.com>
* Fix doc errors.Frederik Gladhorn2012-08-284-11/+3
| | | | | Change-Id: I38d01d3b5d2b9b15edd389ea17142bd75f00e135 Reviewed-by: Geir Vattekar <geir.vattekar@nokia.com>
* qsql_oci: use OCI_COMMIT_ON_SUCCESS for SELECT without transactionMark Brand2012-08-131-7/+2
| | | | | | | | | | Otherwise, the open statement, say in QSqlQueryModel, will prevent other statements from running. Task-number: QTBUG-18608 Change-Id: Icdd6817fb981678be6fb70ade21a8123e152dcf6 Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
* rename qt_module_config.prf => qt_module.prfOswald Buddenhagen2012-08-081-1/+1
| | | | | | | this is more logical, following the qt_plugin and qt_tool scheme. Change-Id: Ib3b2abec6728cdab260e15128b1cd78e8e6f5d6a Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* Add possibility to add OpenSSL, DBUS, MySQL path under WindowsAndreas Holzammer2012-08-071-0/+5
| | | | | | | | | | | Under Windows it's quite possible that OpenSSL, DBUS or MySQL is not installed into a central place. If -I and -L is passed at configure time, it is added to all targets, and if that path contained a conflicting header things would go wrong. Change-Id: Ic3338c49aa6eaa91b3abf5341e709ef604bf7aab Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Doc: Adding a landing page for Qt SQL.Jerome Pasion2012-08-063-3/+37
| | | | | | | | -Simple landing page which contains a link to the SQL guide and API. -Gave a new title to C++ API page. Change-Id: I54eca4f6933bafa0affd5825e7fe2e1a2522dad0 Reviewed-by: Geir Vattekar <geir.vattekar@nokia.com>
* Fix some typos.Frederik Schwarzer2012-07-262-2/+2
| | | | | | | Change-Id: I3c3c96fbbc19e2a69ac2f22618f15f5262718e50 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* QSqlTM: add reimplemented record() methodMark Brand2012-07-172-3/+34
| | | | | | | | | | | QSqlQueryModel::record(row) populates the record it returns with values from virtual data(), so the values themselves can be supplied by QSqlTableModel. However, it is also desirable to be able to interrogate QSqlTableModel for the actual current record in its cache, including properties such as the generated flag. Change-Id: I733901913b7d237d5762448e953a99b5bd83fc7f Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
* QSqlTM: use generated flag more correctly in setRecord()/insertRecord()Mark Brand2012-07-171-11/+19
| | | | | | | | | | | | The generated flag should affect the generation of SQL commands rather than how the fields of the source record are applied to the model before submitting. This correction allows setRecord() to be used to change TRUE generated flags to FALSE. Clarified documentation on this point and updated change log. Change-Id: I7ee124930822561ed8beee6c6259970b3e929c9b Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
* Fix error when inserting to tables with datetime fields with QODBCThiago A. Correa2012-07-161-4/+42
| | | | | | | | | | | | | SQL Server 10 introduced stricter rules for TIMESTAMP validation, making it necessary to specify the decimal digits. Other databases might do the same as well, so this patch introduces a check for the TIMESTAMP column size and adjusts the decimal digits parameter as needed. Task-number: QTBUG-2192 Change-Id: If6d798c6c928ebda75bc474e49a07fbbfbe5816c Reviewed-by: Mark Brand <mabrand@mabrand.nl>
* Doc: Fix typo foreigh -> foreignSergio Ahumada2012-07-161-1/+1
| | | | | | Task-number: QTBUG-23260 Change-Id: I922a8b5cba5d8784305fb1779ccd352ab2ece365 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Add support for SQLSTATE error codesAndras Mantia2012-07-031-12/+18
| | | | | | | | | | | | | Postgres can report detailed information about an error using error codes. See http://www.postgresql.org/docs/8.1/static/errcodes-appendix.html . The current driver doesn't report the error, nor is it supported by the QSqlError object. The patch appends the error to the error message, helping applications to: - handle different errors in a specific way - show correct, translated error messages, independently on the language of the postgres installation Change-Id: Ica3530ac33d3aaa9985e06f6c1f302ece9891033 Reviewed-by: Mark Brand <mabrand@mabrand.nl>
* Clean up the EXPORT macros in qglobal.h.Thiago Macieira2012-06-295-0/+13
| | | | | | | | | | | | | | | | | | | | QtPlatformSupport is a static library. It should never export anything, so Q_PLATFORMSUPPORT_EXPORT is unnecessary. QtSql, QtXml, QtDBus, QtOpenGL and QtPrintSupport now have the macros on their own source trees. It's possible these modules might be separated out from qtbase in the future. For QtDBus, the macros are moving back to where they used to be. This also leaves qglobal.h only creating the macros for QtCore, QtGui, QtWidgets and QtNetwork, the core libraries. Q_CANVAS_EXPORT, Q_OPENVG_EXPORT and Q_COMPAT_EXPORT aren't used anywhere in the Qt sources, so simply delete them. And the Q_QUICK1_EXPORT macro in the static section was wrong, so remove it too. Change-Id: I50bdf86e783338f814903b25979721f788a7becf Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>