Commit Graph

125 Commits

Author SHA1 Message Date
Marco Bubke
613dec7c92 Sqlite: Tweaking reserve of values function
We now save the size of the maximum of all results. This can be improve
performance if the result set sizes are similar. If the very different
we will allocate to much memory. Because it is not changing any results
it's hard to test. We maybe should add benchmarks later.

Change-Id: I07227200076365b7fe4d0ac3951981469f9d454f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-26 18:10:52 +02: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
e979640892 Sqlite: Activate mmap
Mmap can be moch more performant.

Change-Id: I95ed6342bae25dba906391b3a725303e22d33bff
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-26 18:10:24 +02:00
Marco Bubke
245adca2a4 Sqlite: Add some configuration options
Look at https://www.sqlite.org/compile.html#_HAVE_SQLITE_CONFIG_H to get
deeper insigth.

Change-Id: I52b113035035714af6cae4dc276ad8216d1c0e68
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-26 18:10:11 +02:00
Marco Bubke
2c03be75f8 Sqlite: Add more stats for the optimizer
Change-Id: Ic2e5cc95a395c76ffc2ccb835071ea05f4e490fc
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-26 18:09:57 +02:00
Marco Bubke
2f6a226dd3 Sqlite: Forbid double quotes which are not part of the SQL standard
It's anyway easier to write single quotes.

Change-Id: Ie71c39d9cdd83e0b898efe70a1912d8257ac991e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-26 18:09:47 +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
30d5684ac2 Sqlite: Add some more optimization flags
Change-Id: Ia6e22a6587754c98689ff1bea73ca977fa7a141a
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-26 18:09:04 +02:00
Marco Bubke
ebbb88b11a Sqlite: Derive Sqlite::Exception from std::exception
Change-Id: I11a1162e5b450f71b8c2c4068ace6ef08825d7bb
Reviewed-by: Michael Winkelmann <michael.winkelmann@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-14 18:02:54 +00: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
4b7aeae749 Sqlite: Add check constraint
Change-Id: Ib4b909da40c7fe07dcb6a07c4650a720313391c2
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-14 10:30:44 +00:00
Tim Jenssen
9936b92de3 fix visit from future using
Change-Id: I66387627c03de501a9effbb453c17a298437d8c1
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2020-05-14 09:58:28 +00:00
Marco Bubke
c4bbc74e37 Sqlite: Improve constraint support
Now you can add more than one constraint. And we added some
new constraints too.

Change-Id: I849d2d2ef6e44c897a65ff2bdfe8d172a345c991
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-14 09:15:00 +00:00
Marco Bubke
a86fd58e40 Sqlite: Improve LastChangedRowId
Sometimes we want not only the row id from one table but two or three.

Change-Id: I6d5444a71ecbfe6c1af8073be80b04932ea9268d
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-14 09:14:35 +00:00
Marco Bubke
a4b00a7742 Sqlite: Add update hook and use it to get the last changed id
Sqlite has a function to get the last inserted rowid but very often you
want to get the updated rowid too.

Change-Id: Ie276a5039682813ad16597433996a2959f54d9ba
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-12 13:05:57 +00:00
Marco Bubke
f02934458e Sqlite: Add foreign key support
It is still only support references in columns but so far it is enough.

Change-Id: Iebb4866cf738d651270e54357b5e4a2837f05417
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-07 12:14:58 +00:00
Marco Bubke
2d0fab50c1 Sqlite: Locking the walCheckpointFull()
To call this function from a thread we have to lock it. There is no test
because there is no reasonable way to doing it. Anyway, this code is very
simple, so there no reason to see that there is an error in it.

Change-Id: Ibe57ddf421bc60929993afedecbde8c8486eb4db
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-05 11:26:26 +00:00
Tim Jenssen
c10914204a Merge remote-tracking branch 'origin/qds-1.50' into qds-1.59
Change-Id: Ida988ba118b8e39b4dd05c53f45de6863aef8871
2020-04-28 11:56:16 +02:00
Cristian Adam
5dfdeec389 CMake: build fix for unittests
Change-Id: I1ead13e7b764a346ac49004ead2bf9ab6362ffb5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-04-28 07:10:11 +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
Eike Ziller
ae080facf5 CMake build: export less generic public includes
Do not put every plugin's and lib's source folder into public includes.
We require includes of the style <somelib/foo.h> and <someplugin/bar.h>
if someone depends on somelib or someplugin.

Change-Id: I3a9f200b7c3879cf431b00a1bab4a70f7aa0a9ec
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-04-24 11:40:51 +00:00
Milian Wolff
5f494e2e0c Fix CMake build by adding missing library dependencies
This patch fixes the following compile errors when using CMake:

lib/qtcreator/libSqlite.so.4.10.82: error: undefined reference to 'dlerror'
lib/qtcreator/libSqlite.so.4.10.82: error: undefined reference to 'pthread_join'
lib/qtcreator/libSqlite.so.4.10.82: error: undefined reference to 'pthread_mutexattr_settype'
lib/qtcreator/libSqlite.so.4.10.82: error: undefined reference to 'pthread_mutexattr_init'
lib/qtcreator/libSqlite.so.4.10.82: error: undefined reference to 'dlopen'
lib/qtcreator/libSqlite.so.4.10.82: error: undefined reference to 'dlsym'
lib/qtcreator/libSqlite.so.4.10.82: error: undefined reference to 'dlclose'
lib/qtcreator/libSqlite.so.4.10.82: error: undefined reference to 'pthread_mutex_trylock'
lib/qtcreator/libSqlite.so.4.10.82: error: undefined reference to 'pthread_mutexattr_destroy'
lib/qtcreator/libClangSupport.so.4.10.82: error: undefined reference to 'pthread_create'

Change-Id: I7bf4a9f173622c36ac3ea0c7bde5a0999e9b0edf
Reviewed-by: Tim Henning <tim.henning@kdab.com>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-30 12:19:12 +00:00
hjk
2e14df7561 Some clang-tidy -use-modernize-nullptr
Change-Id: I1bed5e85a5b7948d08502a72a10f80baa075c204
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2019-08-01 13:20:26 +00:00
Cristian Adam
8ae9cfe39d CMake build: Add "Devel" package
The "Devel" package will contain headers, libraries, documentation
needed by the 3rd parties to build Qt Creator plugins.

Fixes: QTCREATORBUG-22514
Change-Id: If54929f823982b921b98a63ff6085d53618a3a49
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-25 14:06:46 +00:00
Marco Bubke
596d310d42 Sqlite: Remove temporary unused functions
We will maybe rank the functions in the future but today we don't use that
code.

Change-Id: I84c88b45ceae830c29c3c197e7d0d0c1a6d5c114
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-07-16 08:28:19 +00:00
Marco Bubke
d7e5935396 Sqlite: Handle cases that the database is busy
This should be not be happen but better be save than sorry.

Change-Id: I7b4afe491c07f8d5da2dc13aaffd2f354384a3ae
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-07-11 09:02:23 +00:00
Orgad Shaneh
9a85cc2fac Sqlite: Delete empty sources
Change-Id: Iae592bc22e4781148ec1be7a3ca5746719817f1e
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-06-17 12:53:48 +00:00
Marco Bubke
912cb9278f ClangRefactoring: Ensure that database is written to log after indexing
Change-Id: Ic2473d9fe8dc9b41a7da728c9e1b5202524c1a79
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-06-17 10:46:12 +00:00
Cristian Adam
d855b84c5d Qt Creator CMake port
Based on Tobias Hunger's work from a few months ago.

The CMake configuration needs libclang and Qt paths specified as
CMAKE_PREFIX_PATH.

Auto tests are run with "ctest". At the moment the pass rate is 87%.

Change-Id: Iba98e39bf22077d52706dce6c85986be67a6eab0
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-17 13:33:28 +00:00
Marco Bubke
89e70ca785 Enable Clang Refactoring compiling
We change QTC_ENABLE_CLANG_LIBTOOLING to QTC_DISABLE_CLANG_REFACTORING, so
you now have to opt out instead of opt in. We bump the minimum version of
LLVM to 7.0 too because we mentioned that in the README already.

Change-Id: Ic4ee29a74a3ed79634ed8ea50be84d7bdc7db4ef
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-04-11 10:46:19 +00: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
Ivan Donchevskii
24ac894538 Utils: Enable to construct Utf8String with the string literal
It does not make any sense to specify the number of letters
and it is passed to QByteArray anyways which also accepts -1.

Change-Id: If3a9d8cb039853c7b29ea9c73828fb1983e2f584
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-18 09:09:44 +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
Eike Ziller
fd7cba88ef Merge remote-tracking branch 'origin/4.8'
Conflicts:
	doc/src/editors/creator-only/creator-code-pasting.qdoc
	src/plugins/android/androidbuildapkwidget.cpp

Change-Id: Iea8b7135643d14ffe49d10b14bedb8fa5ac48063
2018-10-24 13:58:45 +02:00
Robert Loehning
4032f6383a Fix frequent typo
can not -> cannot

Change-Id: Ie872ada1bc9b4ed64bffb667c2e44dbb13b4ad11
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2018-10-23 09:30:20 +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
Eike Ziller
e28eb85e8a Merge remote-tracking branch 'origin/4.7' into 4.8
Change-Id: Iaae859601ae4f529c1fa7ada3a5c569820abb0d6
2018-09-26 09:38:33 +02:00
Kai Koehne
ac9ab68740 Fix incorrect grammar in 'does not exists'
Change-Id: I790d9bbdfc170808ff66e70be0f81d1c292c0bcb
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-09-21 12:02:54 +00:00
Ivan Donchevskii
8b6a16c95b Clang: Fix completion after '{'
Follow-up fix for 8d0391a4f9.

Do not complete after '{' coming not after an identifier.
Take constructor completions only for '{' and function
completions only for '('. Filter constructor completions by
class/struct type.

Task-number: QTCREATORBUG-21004
Change-Id: I7ae2d6bee23cf907648c42b93eb12742942833f6
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-08-30 13:36:52 +00:00
Ivan Donchevskii
b1f156ab35 Utils: Provide more QByteArray methods in Utf8String
Change-Id: Ibf33f44f1303b68ec3c9ca2c2fc153ddf6eb1f2c
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-08-02 12:47:08 +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
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
549aa7ee02 Sqlite: Don't register ranking any more
We don't use it now but maybe later.

Change-Id: I46912728321c5523b59cf8e76a75c538f903b618
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-04-04 13:36:38 +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
b6c038924c Sqlite: Fix container programming bug
We really want to delete the right copy and move constructor.

Change-Id: I9572c197b1be89fc1ce996d65e2de671f48abb4e
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-04-04 13:36:17 +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
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
5870905db6 Clang: Handle a busy database in the PCH plugin
This can be always happen for write statements. It fixes the wrong behavior
of the transaction that it tried to rollback if begin fails. If begin fails
the transaction never started so there is nothing to rollback.

Change-Id: I8a03162257fa22a0bb66ccb844f90c6afbc7db64
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-04-04 13:35:06 +00:00