Commit Graph

6 Commits

Author SHA1 Message Date
Marco Bubke
d4c6f06a63 Sqlite: Introduce BindParameterCount template parameter
The BindParameterCount is checked at compile time and then again for
the construction of the statement. So we provide an early error instead of
an some error later or even stranger behavior.

Change-Id: I860ca1f78645c222ae1accf5c7a469c77befc3bd
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-12-09 13:13:51 +00:00
Marco Bubke
e4fea9f159 QmlDesigner: Add project storage
Task-number: QDS-4252
Change-Id: Ic74e027b20bc41f3712e3ae155cddc64f8972cb0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-05-31 16:16:48 +00:00
Marco Bubke
5fda083436 Sqlite: Add exception if statement is called outside of a lock
Sometimes it is really hard to trace if sqlite statement is called
outside of a database connection lock. So we know throw an exception
in the unit test. So we get failing tests.

Change-Id: I71485b9473075751a2fb771ce7e2954e28d8413e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-05-31 16:07:14 +00:00
Marco Bubke
f69314b6ae Sqlite: Add range getter
Sometimes it is handy to return a range so you can break in a for range
loop. So you can now write:

for (auto [key, value] :
    statement.range<std::tuple<long long, std::string>>()) {
    values.push_back(value);
    if (value == Tuple{"foo", 23.3, 2})
         break;
}

for (auto [key, value] :
    statement.rangeWithTransaction<std::tuple<long long, std::string>>()) {
    values.push_back(value);
    if (value == Tuple{"foo", 23.3, 2})
         break;
}

It will only step over the statement to the break. So you don't fetch
not used values anymore. The second version will add a transaction
around the range.

But be careful. The range is view to the statement. Holding it longer or
reusing it can lead to strange behavior because the state of the
statement is changing.

Change-Id: I90191f7da5a015c7d8077d5bc428655a2b53246c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-04-26 09:42:40 +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
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