Commit Graph

30 Commits

Author SHA1 Message Date
Marco Bubke
b758bb7e50 Sqlite: Make carray bind const
Carray is not changing the pointer so it is fine to use a const pointer.

Change-Id: Iad89666b6f543496e39cfeff17e069feb2002ff5
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-07-29 12:16:19 +00:00
Marco Bubke
f764e4f0aa Sqlite: Change error handling for reset
Error handling in reset() is not needed because it is only repeating
the errors of step(). We do already handle them. Reset() is also mostly
called in destructors so we can not do much about error there. Reset
is only now reset the statement to a clean state again which is what
we want.

Task-number: QDS-4286
Change-Id: Ifa50859f3d47cc110ef03d7273a01d4419eca9aa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-05-31 16:13:58 +00:00
Eike Ziller
bf5b1d714c Revert "Revert "Merge remote-tracking branch 'origin/4.15'""
This reverts commit f0a86d4510.

Reverting a merge doesn't "undo" it - the changes would be lost
forever even with subsequent merges.
So we need to revert the revert to get the changes.

Change-Id: I65928f876f4dc886561bed17c4b2aa42b388c1e3
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2021-05-07 09:07:40 +00:00
Marco Bubke
f0a86d4510 Revert "Merge remote-tracking branch 'origin/4.15'"
This reverts commit 888ca0dd20.

Reason for revert: wrong patchset

Change-Id: I1291789938601aaf606c59917ff938e3c24c78dd
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-05-06 15:30:02 +00:00
Tim Jenssen
888ca0dd20 Merge remote-tracking branch 'origin/4.15'
Conflicts:
	src/libs/sqlite/sqlitebasestatement.h
	src/plugins/qmldesigner/qmldesignerplugin.cpp

Change-Id: I0fa0a8a7feffed24c0d2bc26eca86590f1156755
2021-05-06 13:07:48 +02:00
Marco Bubke
1618937637 Sqlite: Use config.h instead of setting everything in the build files
Change-Id: Ia70a5e78475a8b8078276df03330060c8785bf90
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-05-05 15:14:49 +00:00
Marco Bubke
2bf45ec998 Sqlite: Fix handling of blob and blob views
Change-Id: I90c31307ff3299975f820e191085ba93ed8afe0f
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-04-19 12:25:22 +00:00
Marco Bubke
393c65e34e Sqlite: Use std::byte
Change-Id: Ie5bdbae67f7d0f9e533ad20ddb66d03057df2028
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-03-30 07:30:02 +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
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
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
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
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
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
36fd58fbe9 Sqlite: Add carray extension from Sqlite and a pointer binding
Change-Id: I96c160514ac80458cbcbff0151c685958de71fdd
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-26 18:10:40 +02:00
Marco Bubke
dc2192ef8a Sqlite: Dont compile Utf-16 support
We don't support it anyway.

Change-Id: I35fa859f3c9d7389e3d00d584832a814acb39c80
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-26 18:09:26 +02:00
Marco Bubke
33a833d187 Sqlite: Add null value
So we can distingish between a null value and zero or an empty string.

Change-Id: I9122fdafdf85cf04dcf8bca7bf294be9b28ee251
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-14 18:02:18 +00:00
Marco Bubke
0e1870368c Sqlite: Add Sqlite::Value
It adds a layer if you don't know if the type is integer, float or string.
It does not handle bytearrays here because so far there is no need. There
are two classes, Sqlite::Value and Sqlite::ValueView. Value owns the
string, ValueView holds only a view the string. So there is no allocation.
It is designed to hold Utf-8 string like Sqlite but it can be easily
converted in and from QString or QVariant but mind about that this is not
free. ValueView has no constructors on perpose because it would be
ambiguous if there would be constructors for the other primitives of
the Sqlite layer like "int64", "double" and "string view".

Change-Id: Ia39364eb2fc1998e5c59fdb4316add22c748507d
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-04-27 18:17:11 +00:00
Marco Bubke
390a227df6 ClangPchManager: Introduce PchTaskQueue
With the PchTaskQueue the pipeline is almost complete.

Task-number: QTCREATORBUG-21346
Change-Id: I5f05d525db1679eb37dd1d462076c1ed42958099
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-12-10 17:09:31 +00:00
Marco Bubke
42ecd2ed3d Clang: Fix reset for write and execute in the sqlite statement
We were not reset a statement if we got an exception. There are now test
for it.

Change-Id: Ife7b4437fece9369767605ba7387bd0564c1bb8d
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-04-09 13:09:55 +00:00
Marco Bubke
071a6f90d3 Sqlite: Throw misuse Exception in SqliteStatement::bind
Change-Id: I014cf7e067bc67c38448bd79a179858c8abb0b5b
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-04-04 13:36:32 +00:00
Marco Bubke
5e42bbc7fb Sqlite: Throw IoError in SqliteStatement::prepareStatement
If we get this any hope is lost any way but we now know why. ;-)

Change-Id: Ic08b104825dc51ce5453203e70a0804265e47330
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-04-04 13:36:25 +00:00
Marco Bubke
23865a102d Clang: Handle constraint exceptions in the file path storage
It can be happen that the entry is written by an other connection after
we tried to read and before we write. This would lead to a double entry
which be prevented by the unique index in the database. In that case we
simply try again and read the id from the database.

Change-Id: I6c9d94e95ae11556bb446813f64be0855be4ddbe
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-04-04 13:35:37 +00:00
Marco Bubke
0a3df84533 Sqlite: Use string view as result value
String view is returning simply the string pointer and the size from the
database. In that way we remove useless copies to an intermediate data
type.

Change-Id: I3354061938c52df585e91054a97c900ae4cd39b3
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-23 18:03:32 +00:00
Marco Bubke
0d3ee85c51 Sqlite: Cleanup error handling in sqlite statement
We mixed result code and error handling which is now separated.

Change-Id: Ibb9c5f0eb3b77c350eac67884d377ba1baaf76c6
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-18 13:13:37 +00:00
Marco Bubke
d2e15e5f1e Clang: Add file cache
The database is using file path integer ids to handle file paths because
otherwise we would save many redundant data. This patch is improving it
further with the introduction of a database based file path cache. The
entries are now divided in a directory path and file name. This is quite
handy for directory based file watching.

Change-Id: I03f2e388e43f3d521d6bf8e39dfb95eb2309dc73
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-05 17:36:37 +00:00