Commit Graph

23 Commits

Author SHA1 Message Date
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
36711dab34 Sqlite: Export interface
Change-Id: I17fffdb2d6ca43e5f0897c0c86dd461b0d844699
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-05-26 18:11:44 +02:00
Marco Bubke
75f74791a1 Sqlite: Use exclusive lock for table initialization
We cannot change tables if other connections access the database.

Change-Id: I1915ab491952d9684cb9839957c84c8f7a15c308
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-03-04 13:40:53 +00:00
Marco Bubke
bca41fa9f6 ClangRefactoring: Initialize sqlite database only once
Initializing the database is not cheap so it is better to initializing it
only once. We simply check if the database file already exists and then
skip the initializing step.

Task-number: QTCREATORBUG-21174
Change-Id: I151090c5081c009f7913a30517065be2833791d8
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-09-26 10:38:01 +00:00
Marco Bubke
9d7225d283 Clang: Cleanup transaction statements in the database
Change-Id: I795248492fe952c230fd3a9cf8bf16f3c831f161
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-04-09 13:09:45 +00:00
Marco Bubke
28da1261c8 Sqlite: Use compiled statements for transactions
So we don't recompile them again and again.

Change-Id: I54c95e9d81df86f4944b9e3d45a7277f93f37312
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-04-04 13:36:44 +00:00
Marco Bubke
68c1140d27 Clang: Add busy timeout handler to database
You use now a busy timeout of one second. This is preventing the throwing
of a exception for a busy time under one second.

Change-Id: Iae800a525ad009b594c29883ffb243c1be8b3874
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-04-04 13:35:12 +00:00
Marco Bubke
d36fce4970 Sqlite: Export TransactionInterface
Implementing the Database destructor was working around the non exported
TransactionInterface destructor.

Change-Id: Ia53ca95e7dc1141558adf65894b9c120fc88f4de
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-01 15:04:34 +00:00
Ulf Hermann
14297c9543 Sqlite: Add a dtor to Database
The base class TransactionInterface has a virtual destructor that is not
exported. This means we get linker errors when trying to use Database in
a different library.

Change-Id: Iba431a627dca32d59ea7316b7f3eb07fa209c60f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2018-01-30 09:35:50 +00:00
Marco Bubke
0f8befacd3 Clang: On the road to update and preprocessor support
This patch has grown in a quite big change set and it is really hard to
divide it in different parts.
V2::ProjectPartContainer is now using FileIds instead of file paths. This
cleans code up because it is a big step in the direction that internally
only file ids are used. But it is depending on the file cache, so the
file cache has to be provided as an argument. There is now an interface for
transactions too which are ease the testing of them and enables the support
of preprocessor. It adds macros as symbols and is saving used macros. The
used macro support is enabling update improvements because only if a
changed macro is used it needs to be recompiled. This is still in flux
and can be changed in later patches.

Change-Id: I492a2c9af1201d40fdd9f46a0045f7878bbbaa3d
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-01-29 13:47:09 +00:00
Marco Bubke
51f1ce7810 Sqlite: Add journal option to database constructor
Makes tests much easier.

Change-Id: I8b5892ff0deb2e22ac0e874dda0d8d20a32fd2e6
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-21 13:39:40 +00:00
Marco Bubke
816a9175be Sqlite: Extend database
lastInsertedRowId() function was added and more test are now under test.

Change-Id: I02bf11dbab29654dbff9f2cad8c13c0c4d15e3be
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-21 12:35:18 +00:00
Marco Bubke
382c9647e8 Sqlite: Remove the Sqlite Prefix
We use a name space now, so the prefix is not of much use.

Change-Id: I2b077576f94dab778add6ab2e54870f7ca18da78
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-18 13:37:11 +00:00
Marco Bubke
1a25b61576 Sqlite: Improve Sqlite wrapper
It is now possible to read values at once.

for (auto [name, value] : statement.tupleValues<String, int>(1000, "foo", 20))
   ....

Change-Id: I3d4bc5218810b4620e1df625126aa490f30bbc71
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-08-28 14:50:33 +00:00
Marco Bubke
98035954c9 Sqlite: Add Read and ReadWrite mode to database
We want open databases in read only mode too.

Change-Id: I3b20602d4bd7841c9fca3260edce082d21022052
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-08-02 11:50:26 +00:00
Marco Bubke
52a911b972 Sqlite: Cleanup table and column handling
Using values instead of pointers makes the handling much easier. We can
remove ColumnDefinition too, and use SqliteColumn instead.

Change-Id: I224db9cc569c4dfb6e2746179b02096904bfbccb
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-08-02 11:50:18 +00:00
Marco Bubke
a41183f6c7 Sqlite: Add variadic bind and write functions
You can now write

SqliteWriteStatement statement("UPDATE test SET name=?, number=?
                                WHERE rowid=?", database);

statement.write("see", 7.23, 1);

and

SqliteWriteStatement statement("UPDATE test SET name=@name, number=@number
                                WHERE rowid=@id", database);

statement.writeNamed("@name", "see", "@number", 7.23, "@id", 1);

This is more type safe than using variants and performant too.

Change-Id: Ie1ed2a6d326b956be5c4ec056214f3f5b1531f45
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-08-02 11:50:12 +00:00
Marco Bubke
71e1f66284 Sqlite: Add excute to the database
To execute some simple pragmas etc..

Change-Id: Iaa74406a182897dd55ee3ee8dc4d4b94bb8a8e11
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-08-02 11:50:07 +00:00
Marco Bubke
2fed425cd3 Clang: Cleanup string interface of sqlite
We only will need the utf8 optimized SmallString for the indexer database.
So we remove all other string bindings, QByteArray and QVariant.

Change-Id: I4a77901a80b26bf292fc85df535c2ccf3a8ab52f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-08-01 13:44:50 +00:00
Marco Bubke
400da9def8 Sqlite: Remove static database handle
Change-Id: Ic31f61a477ad681652eeccdaa39f82970c57eb5a
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-07-27 09:14:48 +00:00
Marco Bubke
3dcce060b2 Sqlite: Cleanup Sqlite
We don't need the threading anymore, so we removed it. The indexer
will be run in its thread anyway, so an extra thread makes the code
only more complicated. And we added namespaces.

Change-Id: Ibcba306324763285cf653c28bb08122345e5f8da
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-07-27 09:14:30 +00:00
Tobias Hunger
f72370f20a Update License according to agreement with Free Qt Foundation
* Update remaining files in src

Change-Id: I1896f17fcf34f71c3310c87899fb5171b8e4afb1
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-19 15:59:41 +00:00
Marco Bubke
e2f8a9883b Introduce codemodelbackend process and library
This is a partial result of wip/clang-oop. More will follow.

This allows us to invoke the completion out of the Qt Creator process
and thus safes us as against libclang crashes.

At this point only the completion use case is supported.

Some notes on the individual components:

 src/libs/codemodelbackendipc
  * library encapsulating the inter process communication handling
  * used by the backend application and in a follow-up change by the
    creator integration

 src/libs/3rdparty/sqlite
  * version 3.8.10.2
  * dependency of codemodelbackendipc, will be used to storage indexing
    data, among others

 src/tools/codemodelbackend
  * the backend application

 tests/unit:
  * unit tests

Change-Id: I91a48e27467581a22fb760a18d8eb926008fea60
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-06-03 14:22:09 +00:00