Commit Graph

230 Commits

Author SHA1 Message Date
Marco Bubke
f57694948e Sqlite: Cleanup sqlite statement
Change-Id: I727a95491a45fe01bf59821d4f451f25483745ed
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-03-30 07:29:55 +00:00
Marco Bubke
7785a3a651 Sqlite: Move result count to class declaration
It move the magic number of column results to the sql statement
and improves the mock a little bit.

Change-Id: I101067444cf27ec5dea0c72de7fd484a7e8710f0
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-03-26 12:24:37 +00:00
Marco Bubke
1ad6133161 Sqlite: Return auto instead of type to symplify test overload
Change-Id: I4b613a93f823f346021118eb532ae660295f3c6b
Reviewed-by: Tapani Mattila <tapani.mattila@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-03-22 08:34:50 +00:00
Marco Bubke
f777ab0f0a Sqlite: Add ReadWriteStatement alias to database
Change-Id: Ib5a7936d626cc147b7e1ac5973b42fa083b163ac
Reviewed-by: Tapani Mattila <tapani.mattila@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-03-22 08:34:44 +00:00
Marco Bubke
52143466a2 Sqlite: Prevent copying of LastChangedRowId
Change-Id: Ibed20ce8ee33a8f50756903f3133cb47cdfab218
Reviewed-by: Tapani Mattila <tapani.mattila@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-03-22 08:34:38 +00:00
Marco Bubke
baab71c073 Sqlite: Add busy handler
A busy handler is much more flexible than a timeout. In most cases we can
remove the busy exception handling code.

Change-Id: I59666ccfbd380a341412e3d25e6716b07097bf3c
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-03-22 08:34:33 +00:00
Marco Bubke
9b1f4f7c29 Sqlite: Update documentation
Change-Id: I0c6a7fc82ee3ae22c4c4f74567b3198c71dc592b
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-03-17 09:11:52 +00:00
Marco Bubke
a6f944e472 Sqlite: Use emplace_back instead of push_back
It does not only removes code it should be even more optimal.

Change-Id: I819a7300ca798c3109b20c1e3bafcd19078faebd
Reviewed-by: Tapani Mattila <tapani.mattila@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-03-09 08:58:05 +00:00
Marco Bubke
20690236d7 Utils: Add iterator constructors to small string
Change-Id: I34e15177268f0733200d25c90fd935485c3176ae
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-03-09 08:57:30 +00:00
Eike Ziller
dce690ab73 Fix build with Qt 6
Change-Id: I67ffc389d7579ac98755ec99614ce9b3e4e07df5
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-02-26 09:26:15 +00:00
Eike Ziller
36b23fff03 Merge remote-tracking branch 'origin/4.14'
Change-Id: I42000e1ceca42f97c4e512505161151ab7369cd0
2021-02-18 14:16:04 +01:00
Marco Bubke
fd6446e07b Sqlite: Fix missing typename
Some compilers are more picky than others.

Amends e3d12e659a.

Change-Id: Idb189658724880252e17ff1d561a13e281d2ec3a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-02-18 12:54:10 +00:00
Eike Ziller
768d4321f9 Merge remote-tracking branch 'origin/4.14'
Change-Id: I214b8d59e8ff7fe0511cd6116ec7725ddc4376ee
2021-02-18 09:26:22 +01:00
Marco Bubke
e3d12e659a Sqlite: Add readTo method
There are cases when you want to read to an already existing container.
This will prepare for the RETURNING extension in the next Sqlite version
where you can write and read. That will simplify quite some code.

Change-Id: I740ffbedecf72bb5518392f3707a0a6b2221db56
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-02-15 10:39:45 +00:00
Marco Bubke
18fe4233f8 Sqlite: Add callback method
Sometimes it is better to have a callback instead of returning a container.
The call has to manage the state if an exception is called but otherwise
it will reduce the memory footprint. There will be to a RETURNING
to Sqlite which will read back values as you write.

Change-Id: I7eb49850e2c76f883a03277b31c5e713e9774c92
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-02-15 10:39:30 +00:00
Marco Bubke
7dc72c533e QmlDesigner: Improve imagecache
Instead of coding some arguments to extraId(state) we provide now a
std::variant there extra arguments can be saved. Because it's a
std::variant it can be easlily extended by new structs. There is a new
synchronous interface too. It has an extra method for QIcon which saves
icons in an extra table. It would be even nicer if we would have a
mipmap image too. So we could do it asynchonously too but so far it works
only in the main thread.

Task-number: QDS-3579
Fixes: QDS-3584
Change-Id: If368d84d82308a91a5f4f037021e749c9ef868ed
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-01-21 13:14:28 +00:00
Marco Bubke
a477118b22 Sqlite: Activate extended error codes
It makes it easier to debug the error.

Change-Id: Id2591c6d8a546f2020ddb276d246706e0c60f052
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-01-14 10:49:54 +00:00
Marco Bubke
b11d8aa92a Sqlite: Update Sqlite from 3.31.1 to 3.34 and adapt carray
You can now pass everything you can convert to a span directly and bind it
with a carray instead of using the pointer interface. This is working for
int, long long, double and null terminated C strings.

Change-Id: I274c218e2dec0f11e68576545bb78601f85462bd
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-01-06 14:41:01 +00:00
Mahmoud Badri
084944a96b Fix Qt Creator + Coco build
param name "interface" is causing Qt Creator build fail when integrating
Froglogic Coco tools with Qt Creator.

Fixes: QTCREATORBUG-25146
Change-Id: If3fa3d44e941089a882deb44ba12dec6d00ad73d
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
(cherry picked from commit f30565873a)
2020-12-23 12:30:57 +00:00
Christian Stenger
aa67aa8b2a Sqlite: Fix unittest build on macOS
Change-Id: Id412d0098a1287d5e93c29690bfcf269be1315f3
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2020-11-16 10:27:05 +00:00
Jarek Kobus
fdef05c96e Get rid of compiler warning
Silence the warning:
type qualifiers ignored on cast result type [-Wignored-qualifiers].

Change-Id: I3d02a1b71b6cece6d4fcfe209ef37cdf5556afba
Reviewed-by: hjk <hjk@qt.io>
2020-11-13 08:21:51 +00:00
Marco Bubke
6fc3f65ce0 Sqlite: Add swap for ConstIterator
Otherwise we get an recursion.

Change-Id: Ia8dfcbeae30b25d9d347404ae85b852c4c11c921
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-11-11 08:42:16 +00:00
Marco Bubke
f90bc7fa37 QmlDesigner: Improving SessionChangeSets
Task-number: QDS-2998
Change-Id: I9b559bf593dd968172649d1f6c45fb9fb454f1a5
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-11-10 14:32:39 +00:00
Marco Bubke
c3873fcf40 Sqlite: Add change set iterator
Task-number: QDS-2998
Change-Id: I7bfa8af51d9d7e6122902ee132ad51019e20afb5
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-11-03 09:19:54 +00:00
Marco Bubke
d1b0c12d6b QmlDesigner: Add image cache
The image cache is saving images and icon of this images in a sqlite
database. If there are no images they are generated in the backgound.
The icons are fetched by item library.

Task-number: QDS-2782
Task-number: QDS-2783
Task-number: QDS-2858
Change-Id: I5a32cccfef7f8fd8eb78902605a09f5da18ce88e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-10-16 10:01:21 +00:00
Eike Ziller
7c93f25ae9 CMake build: Fix issues with exported targets
Remove unneeded and wrong include paths which ended up as invalid
include paths in the exported QtCreatorTargets.cmake.

Add missing sqlite header.

Change-Id: Icce60037160ff06b032a03df47e6834422f86f57
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-10-06 11:08:59 +00:00
Eike Ziller
0c4135e380 Merge remote-tracking branch 'origin/4.13' into master
Conflicts:
	src/plugins/android/androiddeployqtstep.cpp

Change-Id: Id624bad384050d567efba0700046331086cb12dd
2020-08-13 13:28:33 +02:00
Tim Jenssen
4fe5b923cd Merge remote-tracking branch 'origin/qds-1.59' into 4.13
Change-Id: Ic720f3adab305c5ef8cd10e713ccabf510eff0c0
2020-08-13 06:39:40 +00:00
hjk
004e5ad83d Sqlite: Suppress deprecation warning when using C++17
Change-Id: I90f452230cd7a2975674e3d17bd6c930914f90d5
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2020-07-23 13:27:45 +00:00
Tim Jenssen
33671897bd sqlite: exceptions are necessary for sqlite
Qt itself is using no exceptions but if we want to
use this sqlite access code we need to enable it.

Change-Id: Id69b8527c612e06a534bc100e5339cddf5471917
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2020-07-02 13:03:02 +00:00
Tim Jenssen
b8cd87dea0 Merge remote-tracking branch 'origin/qds-1.59' into 4.13
Conflicts:
	src/plugins/clangformat/clangformatplugin.cpp
	src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
	src/plugins/qmldesigner/qmldesigner.qbs

Change-Id: Ie4a0beeb9fd32ac9683f4e8769988a9c3f3e369a
2020-06-26 16:51:22 +02:00
Artur Shepilko
f3c2f68c39 Sqlite: Fix a compiler warning about unhandled switch-case
Change-Id: Id9cb6ebd6db7f718f8aa3e25d56581f953ad182e
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2020-06-24 15:04:20 +00:00
Marco Bubke
ce942bd33c Sqlite: Extend error handling
We do only handled errors for the v1 interface. Now we handle much more.
Sadly this is hard to test, so there are no tests.

Change-Id: I6f55dc1bad744776bb33a6d0d6c71e52d2f097f6
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-06-19 09:07:41 +00:00
Christian Kandeler
0861ba2fc9 sqlite: Fix qbs build
Exporting the full sqlite interface can lead to run-time conflicts with
the system sqlite that Qt's SQL support pulls in.
So re-build the sources for the unit test, as in the qmake build.

Change-Id: I8394b9c0aa4e21704bc84600f40b8f5d706ad66d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-16 12:43:00 +00:00
Tim Jenssen
3acdb7891b Merge remote-tracking branch 'origin/qds-1.59'
Change-Id: I8891e7490a7fd51997a3b57561961f6134be3252
2020-06-11 12:54:10 +02:00
Marco Bubke
5a7a6cb02d Sqlite: Remove last usages of UpdateCallback
Change-Id: Ie7ffe06c55a7827fae20996e5b0eadb9892b9e23
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-06-10 13:34:27 +00:00
Christian Kandeler
31ef76d304 Sqlite: Fix qbs build for unit test
Change-Id: I02c0917788fbe97377b69e30d08e84323d9c1e97
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-10 11:10:44 +00:00
Marco Bubke
acf5329422 Sqlite: Fix null handling
Most of it is only silencing a warning but one is fixing a faulty test. So
writing null values should now be working.

Change-Id: If702e1fc8176a9e0ae82a5589c719d567929202b
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-06-10 09:05:00 +00:00
Christian Stenger
c02a0037d5 Sqlite: Fix unit test build
Change-Id: I29c15bbad053a3bac01ea05ad06ff994ce0d8d06
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2020-06-09 14:50:09 +00:00
Marco Bubke
06866c3ee9 Sqlite: Use a more efficient update hook
Change-Id: Ic6df1f4ba6b914c7751faf7cf89083fa50a92793
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-06-09 14:48:27 +00:00
Tim Jenssen
106f11a42f sqlite: make defines public
Change-Id: I44d1636cdb7f1dce9a3b25fe8f5e9f11f5364cdb
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2020-06-08 12:30:58 +00:00
Tim Jenssen
90fcca16e8 sqlite: mingw compile fix
Change-Id: Ia427231c864144b7a83a8346e050acc2d4531851
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2020-06-05 16:04:03 +00:00
Tim Jenssen
128980bb84 sqlite: fix qbs and cmake builds
Change-Id: I64887c2dd11b8de8627976b148993467e70674e0
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2020-06-05 16:03:54 +00:00
Marco Bubke
cf441e8198 Sqlite: Add primary key table constraint to table builder
Change-Id: I60c158eb76db2217a2d045053bb8e47eef75ff7a
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-06-05 09:57:47 +00:00
Marco Bubke
a61eff0079 Sqlite: Add session support
Session are captured by hooking in the sqlite changes. They are saved in
blobs and containing inserts, update and deletes. Because the are
semantically coupled to translactions we add a

Change-Id: Ie095558ebc50601fcaae32958ebeeb98b72d73b9
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-06-05 09:52:42 +00:00
Marco Bubke
9d3087b9b4 Sqlite: Fix CMakeLists.txt
Change-Id: I53d862aabe76f2b5edefb8e365af8ab73f4994f5
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-28 09:25:58 +00:00
Marco Bubke
a9a205486d Sqlite: Improve SqliteStatement column check
We have done it for every getter. Now we do it only once as we ask for
the values. It simplifies the code and the test and could even improve
performance.

Change-Id: Ia7d4a33a77ec7c0a5fda548424fbf8b192f07511
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-05-27 13:26:07 +00:00
Marco Bubke
9f9140b196 Sqlite: Remove unused code
Binding by names is slower and we never used it.

Change-Id: Ia6b9b78401f8c2711be34b667ac6f08b44418773
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-05-27 13:09:35 +00:00
Marco Bubke
9c44f8d88d Sqlite: Add blob support
Change-Id: Ic2ec5f20c8585241b9e9aaa8465e70b6ab4f004c
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-05-27 13:09:27 +00:00
Marco Bubke
22c33fb859 Sqlite: Improve LastChangedRowId
Change-Id: I2fe559d4b40f93561e44eb138119416291dc7d41
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-05-27 13:09:20 +00:00