forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -9,16 +9,7 @@ Module {
|
|||||||
Depends { name: "cpp" }
|
Depends { name: "cpp" }
|
||||||
|
|
||||||
cpp.defines: [
|
cpp.defines: [
|
||||||
"SQLITE_THREADSAFE=2", "SQLITE_ENABLE_FTS5", "SQLITE_ENABLE_UNLOCK_NOTIFY",
|
"_HAVE_SQLITE_CONFIG_H", "SQLITE_CORE"
|
||||||
"SQLITE_ENABLE_JSON1", "SQLITE_DEFAULT_FOREIGN_KEYS=1", "SQLITE_TEMP_STORE=2",
|
|
||||||
"SQLITE_DEFAULT_WAL_SYNCHRONOUS=1", "SQLITE_MAX_WORKER_THREADS", "SQLITE_DEFAULT_MEMSTATUS=0",
|
|
||||||
"SQLITE_OMIT_DEPRECATED", "SQLITE_OMIT_DECLTYPE",
|
|
||||||
"SQLITE_MAX_EXPR_DEPTH=0", "SQLITE_OMIT_SHARED_CACHE", "SQLITE_USE_ALLOCA",
|
|
||||||
"SQLITE_ENABLE_MEMORY_MANAGEMENT", "SQLITE_ENABLE_NULL_TRIM", "SQLITE_OMIT_EXPLAIN",
|
|
||||||
"SQLITE_OMIT_LOAD_EXTENSION", "SQLITE_OMIT_UTF16", "SQLITE_DQS=0",
|
|
||||||
"SQLITE_ENABLE_STAT4", "HAVE_ISNAN", "HAVE_FDATASYNC", "HAVE_MALLOC_USABLE_SIZE",
|
|
||||||
"SQLITE_DEFAULT_MMAP_SIZE=268435456", "SQLITE_CORE", "SQLITE_ENABLE_SESSION", "SQLITE_ENABLE_PREUPDATE_HOOK",
|
|
||||||
"SQLITE_LIKE_DOESNT_MATCH_BLOBS",
|
|
||||||
].concat(buildSharedLib ? "BUILD_SQLITE_LIBRARY" : "BUILD_SQLITE_STATIC_LIBRARY")
|
].concat(buildSharedLib ? "BUILD_SQLITE_LIBRARY" : "BUILD_SQLITE_STATIC_LIBRARY")
|
||||||
|
|
||||||
cpp.dynamicLibraries: base.concat((qbs.targetOS.contains("unix") && !qbs.targetOS.contains("bsd"))
|
cpp.dynamicLibraries: base.concat((qbs.targetOS.contains("unix") && !qbs.targetOS.contains("bsd"))
|
||||||
|
@@ -23,24 +23,25 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <QDebug>
|
#include "iconrenderer/iconrenderer.h"
|
||||||
|
#include "import3d/import3d.h"
|
||||||
|
|
||||||
|
#include <qt5nodeinstanceclientproxy.h>
|
||||||
|
#ifdef MULTILANGUAGE_TRANSLATIONPROVIDER
|
||||||
|
#include <sqlitelibraryinitializer.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <QQmlComponent>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
#include <QDebug>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "iconrenderer/iconrenderer.h"
|
|
||||||
#include "import3d/import3d.h"
|
|
||||||
#include <qt5nodeinstanceclientproxy.h>
|
|
||||||
|
|
||||||
#include <QQmlComponent>
|
|
||||||
#include <QQmlEngine>
|
|
||||||
|
|
||||||
#ifdef ENABLE_QT_BREAKPAD
|
#ifdef ENABLE_QT_BREAKPAD
|
||||||
#include <qtsystemexceptionhandler.h>
|
#include <qtsystemexceptionhandler.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -274,6 +275,10 @@ int main(int argc, char *argv[])
|
|||||||
&& qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_STYLE")
|
&& qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_STYLE")
|
||||||
&& qgetenv("QT_QUICK_CONTROLS_STYLE") != "Desktop";
|
&& qgetenv("QT_QUICK_CONTROLS_STYLE") != "Desktop";
|
||||||
|
|
||||||
|
#ifdef MULTILANGUAGE_TRANSLATIONPROVIDER
|
||||||
|
Sqlite::LibraryInitializer::initialize();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (useGuiApplication) {
|
if (useGuiApplication) {
|
||||||
QGuiApplication application(argc, argv);
|
QGuiApplication application(argc, argv);
|
||||||
return internalMain(&application);
|
return internalMain(&application);
|
||||||
|
@@ -0,0 +1,6 @@
|
|||||||
|
import QtQuick 2.15
|
||||||
|
|
||||||
|
RegularExpressionValidator {
|
||||||
|
id: root
|
||||||
|
property alias regExp: root.regularExpression
|
||||||
|
}
|
@@ -28,10 +28,8 @@ import QtQuick 2.10
|
|||||||
QtObject {
|
QtObject {
|
||||||
readonly property int width: 1920
|
readonly property int width: 1920
|
||||||
readonly property int height: 1080
|
readonly property int height: 1080
|
||||||
readonly property FontLoader mySystemFont: FontLoader {
|
|
||||||
name: "Arial"
|
property FontLoader controlIcons: FontLoader {
|
||||||
}
|
|
||||||
readonly property FontLoader controlIcons: FontLoader {
|
|
||||||
source: "icons.ttf"
|
source: "icons.ttf"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,12 +148,12 @@ QtObject {
|
|||||||
})
|
})
|
||||||
|
|
||||||
readonly property font font: Qt.font({
|
readonly property font font: Qt.font({
|
||||||
"family": mySystemFont.name,
|
"family": "Arial",
|
||||||
"pointSize": Qt.application.font.pixelSize
|
"pointSize": Qt.application.font.pixelSize
|
||||||
})
|
})
|
||||||
|
|
||||||
readonly property font largeFont: Qt.font({
|
readonly property font largeFont: Qt.font({
|
||||||
"family": mySystemFont.name,
|
"family": "Arial",
|
||||||
"pointSize": Qt.application.font.pixelSize * 1.6
|
"pointSize": Qt.application.font.pixelSize * 1.6
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
84
src/libs/3rdparty/sqlite/config.h
vendored
Normal file
84
src/libs/3rdparty/sqlite/config.h
vendored
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3 as published by the Free Software
|
||||||
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#if __has_include(<unistd.h>)
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __has_include(<utime.h>)
|
||||||
|
#define HAVE_UTIME 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (_XOPEN_SOURCE >= 500) && !(_POSIX_C_SOURCE >= 200809L) || _DEFAULT_SOURCE || _BSD_SOURCE
|
||||||
|
#define HAVE_USLEEP 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _GNU_SOURCE
|
||||||
|
#define HAVE_STRCHRNUL 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if _POSIX_C_SOURCE >= 199309L || _XOPEN_SOURCE >= 500
|
||||||
|
#define HAVE_FDATASYNC 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if _POSIX_C_SOURCE >= 1 || _BSD_SOURCE
|
||||||
|
#define HAVE_LOCALTIME_R 1
|
||||||
|
#else
|
||||||
|
#define HAVE_LOCALTIME_S 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define HAVE_MALLOC_USABLE_SIZE 1
|
||||||
|
#define HAVE_ISNAN 1
|
||||||
|
|
||||||
|
#define SQLITE_THREADSAFE 2
|
||||||
|
#define SQLITE_ENABLE_FTS5 1
|
||||||
|
#define SQLITE_ENABLE_UNLOCK_NOTIFY 1
|
||||||
|
#define SQLITE_ENABLE_JSON1 1
|
||||||
|
#define SQLITE_DEFAULT_FOREIGN_KEYS 1
|
||||||
|
#define SQLITE_TEMP_STORE 2
|
||||||
|
#define SQLITE_DEFAULT_WAL_SYNCHRONOUS 1
|
||||||
|
#define SQLITE_MAX_WORKER_THREADS 1
|
||||||
|
#define SQLITE_DEFAULT_MEMSTATUS 0
|
||||||
|
#define SQLITE_OMIT_DEPRECATED 1
|
||||||
|
#define SQLITE_OMIT_DECLTYPE 1
|
||||||
|
#define SQLITE_MAX_EXPR_DEPTH 0
|
||||||
|
#define SQLITE_OMIT_SHARED_CACHE 1
|
||||||
|
#define SQLITE_USE_ALLOCA 1
|
||||||
|
#define SQLITE_ENABLE_MEMORY_MANAGEMENT 1
|
||||||
|
#define SQLITE_ENABLE_NULL_TRIM 1
|
||||||
|
#define SQLITE_OMIT_EXPLAIN 1
|
||||||
|
#define SQLITE_OMIT_LOAD_EXTENSION 1
|
||||||
|
#define SQLITE_OMIT_UTF16 1
|
||||||
|
#define SQLITE_DQS 0
|
||||||
|
#define SQLITE_ENABLE_STAT4 1
|
||||||
|
#define SQLITE_DEFAULT_MMAP_SIZE 268435456
|
||||||
|
#define SQLITE_ENABLE_SESSION 1
|
||||||
|
#define SQLITE_ENABLE_PREUPDATE_HOOK 1
|
||||||
|
#define SQLITE_LIKE_DOESNT_MATCH_BLOBS 1
|
||||||
|
#define SQLITE_OMIT_AUTOINIT 1
|
29
src/libs/3rdparty/sqlite/sqlite.h
vendored
Normal file
29
src/libs/3rdparty/sqlite/sqlite.h
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3 as published by the Free Software
|
||||||
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "sqlite3ext.h"
|
6
src/libs/3rdparty/sqlite/sqlite.pri
vendored
6
src/libs/3rdparty/sqlite/sqlite.pri
vendored
@@ -1,6 +1,12 @@
|
|||||||
INCLUDEPATH *= $$PWD
|
INCLUDEPATH *= $$PWD
|
||||||
|
|
||||||
|
linux:DEFINES += _POSIX_C_SOURCE=200809L _GNU_SOURCE
|
||||||
|
osx:DEFINES += _BSD_SOURCE
|
||||||
|
|
||||||
|
|
||||||
HEADERS += $$PWD/sqlite3.h \
|
HEADERS += $$PWD/sqlite3.h \
|
||||||
|
$$PWD/config.h \
|
||||||
|
$$PWD/sqlite.h \
|
||||||
$$PWD/sqlite3ext.h
|
$$PWD/sqlite3ext.h
|
||||||
|
|
||||||
SOURCES += $$PWD/sqlite3.c \
|
SOURCES += $$PWD/sqlite3.c \
|
||||||
|
@@ -1366,7 +1366,9 @@ bool Check::visit(Block *ast)
|
|||||||
&& !cast<WhileStatement *>(p)
|
&& !cast<WhileStatement *>(p)
|
||||||
&& !cast<IfStatement *>(p)
|
&& !cast<IfStatement *>(p)
|
||||||
&& !cast<SwitchStatement *>(p)
|
&& !cast<SwitchStatement *>(p)
|
||||||
&& !cast<WithStatement *>(p)) {
|
&& !isCaseOrDefault(p)
|
||||||
|
&& !cast<WithStatement *>(p)
|
||||||
|
&& hasVarStatement(ast)) {
|
||||||
addMessage(WarnBlock, ast->lbraceToken);
|
addMessage(WarnBlock, ast->lbraceToken);
|
||||||
}
|
}
|
||||||
if (!ast->statements
|
if (!ast->statements
|
||||||
@@ -1656,6 +1658,33 @@ bool Check::isQtQuick2Ui() const
|
|||||||
return _doc->language() == Dialect::QmlQtQuick2Ui;
|
return _doc->language() == Dialect::QmlQtQuick2Ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Check::isCaseOrDefault(Node *n)
|
||||||
|
{
|
||||||
|
if (!cast<StatementList *>(n))
|
||||||
|
return false;
|
||||||
|
if (Node *p = parent(1))
|
||||||
|
return p->kind == Node::Kind_CaseClause || p->kind == Node::Kind_DefaultClause;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Check::hasVarStatement(AST::Block *b) const
|
||||||
|
{
|
||||||
|
QTC_ASSERT(b, return false);
|
||||||
|
StatementList *s = b->statements;
|
||||||
|
while (s) {
|
||||||
|
if (auto var = cast<VariableStatement *>(s->statement)) {
|
||||||
|
VariableDeclarationList *declList = var->declarations;
|
||||||
|
while (declList) {
|
||||||
|
if (declList->declaration && declList->declaration->scope == VariableScope::Var)
|
||||||
|
return true;
|
||||||
|
declList = declList->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s = s->next;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool Check::visit(NewExpression *ast)
|
bool Check::visit(NewExpression *ast)
|
||||||
{
|
{
|
||||||
checkNewExpression(ast->expression);
|
checkNewExpression(ast->expression);
|
||||||
|
@@ -122,6 +122,9 @@ private:
|
|||||||
bool isQtQuick2() const;
|
bool isQtQuick2() const;
|
||||||
bool isQtQuick2Ui() const;
|
bool isQtQuick2Ui() const;
|
||||||
|
|
||||||
|
bool isCaseOrDefault(AST::Node *n);
|
||||||
|
bool hasVarStatement(AST::Block *b) const;
|
||||||
|
|
||||||
AST::Node *parent(int distance = 0);
|
AST::Node *parent(int distance = 0);
|
||||||
|
|
||||||
Document::Ptr _doc;
|
Document::Ptr _doc;
|
||||||
|
@@ -1,16 +1,7 @@
|
|||||||
add_qtc_library(Sqlite
|
add_qtc_library(Sqlite
|
||||||
PUBLIC_DEFINES
|
PUBLIC_DEFINES
|
||||||
BUILD_SQLITE_LIBRARY
|
BUILD_SQLITE_LIBRARY
|
||||||
SQLITE_THREADSAFE=2 SQLITE_ENABLE_FTS5 SQLITE_ENABLE_UNLOCK_NOTIFY
|
SQLITE_CORE
|
||||||
SQLITE_ENABLE_JSON1 SQLITE_DEFAULT_FOREIGN_KEYS=1 SQLITE_TEMP_STORE=2
|
|
||||||
SQLITE_DEFAULT_WAL_SYNCHRONOUS=1 SQLITE_MAX_WORKER_THREADS SQLITE_DEFAULT_MEMSTATUS=0
|
|
||||||
SQLITE_OMIT_DEPRECATED SQLITE_OMIT_DECLTYPE
|
|
||||||
SQLITE_MAX_EXPR_DEPTH=0 SQLITE_OMIT_SHARED_CACHE SQLITE_USE_ALLOCA
|
|
||||||
SQLITE_ENABLE_MEMORY_MANAGEMENT SQLITE_ENABLE_NULL_TRIM SQLITE_OMIT_EXPLAIN
|
|
||||||
SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_UTF16 SQLITE_DQS=0
|
|
||||||
SQLITE_ENABLE_STAT4 HAVE_ISNAN HAVE_FDATASYNC HAVE_MALLOC_USABLE_SIZE
|
|
||||||
SQLITE_DEFAULT_MMAP_SIZE=268435456 SQLITE_CORE SQLITE_ENABLE_SESSION SQLITE_ENABLE_PREUPDATE_HOOK
|
|
||||||
SQLITE_LIKE_DOESNT_MATCH_BLOBS
|
|
||||||
DEPENDS Qt5::Core Threads::Threads ${CMAKE_DL_LIBS}
|
DEPENDS Qt5::Core Threads::Threads ${CMAKE_DL_LIBS}
|
||||||
PUBLIC_INCLUDES
|
PUBLIC_INCLUDES
|
||||||
"${CMAKE_CURRENT_LIST_DIR}"
|
"${CMAKE_CURRENT_LIST_DIR}"
|
||||||
@@ -19,6 +10,8 @@ add_qtc_library(Sqlite
|
|||||||
../3rdparty/sqlite/sqlite3.c
|
../3rdparty/sqlite/sqlite3.c
|
||||||
../3rdparty/sqlite/sqlite3.h
|
../3rdparty/sqlite/sqlite3.h
|
||||||
../3rdparty/sqlite/carray.c
|
../3rdparty/sqlite/carray.c
|
||||||
|
../3rdparty/sqlite/config.h
|
||||||
|
../3rdparty/sqlite/sqlite.h
|
||||||
constraints.h
|
constraints.h
|
||||||
createtablesqlstatementbuilder.cpp createtablesqlstatementbuilder.h
|
createtablesqlstatementbuilder.cpp createtablesqlstatementbuilder.h
|
||||||
lastchangedrowid.h
|
lastchangedrowid.h
|
||||||
@@ -46,4 +39,13 @@ add_qtc_library(Sqlite
|
|||||||
utf8stringvector.cpp utf8stringvector.h
|
utf8stringvector.cpp utf8stringvector.h
|
||||||
sqliteblob.h
|
sqliteblob.h
|
||||||
sqlitetimestamp.h
|
sqlitetimestamp.h
|
||||||
|
sqlitelibraryinitializer.cpp sqlitelibraryinitializer.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
extend_qtc_library(Sqlite DEFINES _HAVE_SQLITE_CONFIG_H)
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
extend_qtc_library(Sqlite DEFINES _BSD_SOURCE)
|
||||||
|
elseif (UNIX)
|
||||||
|
extend_qtc_library(Sqlite DEFINES _POSIX_C_SOURCE=200809L _GNU_SOURCE _DEFAULT_SOURCE)
|
||||||
|
endif()
|
||||||
|
@@ -248,7 +248,9 @@ void CreateTableSqlStatementBuilder::bindColumnDefinitionsAndTableConstraints()
|
|||||||
columnDefinitionStrings.reserve(m_columns.size());
|
columnDefinitionStrings.reserve(m_columns.size());
|
||||||
|
|
||||||
for (const Column &column : m_columns) {
|
for (const Column &column : m_columns) {
|
||||||
Utils::SmallString columnDefinitionString = {column.name, " ", column.typeString()};
|
Utils::SmallString columnDefinitionString = {column.name,
|
||||||
|
SqlStatementBuilder::columnTypeToString(
|
||||||
|
column.type)};
|
||||||
|
|
||||||
ContraintsVisiter visiter{columnDefinitionString};
|
ContraintsVisiter visiter{columnDefinitionString};
|
||||||
|
|
||||||
|
@@ -15,6 +15,7 @@ SOURCES += \
|
|||||||
$$PWD/sqlitedatabasebackend.cpp \
|
$$PWD/sqlitedatabasebackend.cpp \
|
||||||
$$PWD/sqliteexception.cpp \
|
$$PWD/sqliteexception.cpp \
|
||||||
$$PWD/sqliteglobal.cpp \
|
$$PWD/sqliteglobal.cpp \
|
||||||
|
$$PWD/sqlitelibraryinitializer.cpp \
|
||||||
$$PWD/sqlitesessionchangeset.cpp \
|
$$PWD/sqlitesessionchangeset.cpp \
|
||||||
$$PWD/sqlitesessions.cpp \
|
$$PWD/sqlitesessions.cpp \
|
||||||
$$PWD/sqlstatementbuilder.cpp \
|
$$PWD/sqlstatementbuilder.cpp \
|
||||||
@@ -25,6 +26,7 @@ SOURCES += \
|
|||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$PWD/constraints.h \
|
$$PWD/constraints.h \
|
||||||
$$PWD/sqliteblob.h \
|
$$PWD/sqliteblob.h \
|
||||||
|
$$PWD/sqlitelibraryinitializer.h \
|
||||||
$$PWD/sqlitetimestamp.h \
|
$$PWD/sqlitetimestamp.h \
|
||||||
$$PWD/tableconstraints.h \
|
$$PWD/tableconstraints.h \
|
||||||
$$PWD/createtablesqlstatementbuilder.h \
|
$$PWD/createtablesqlstatementbuilder.h \
|
||||||
@@ -50,16 +52,7 @@ HEADERS += \
|
|||||||
$$PWD/sqliteindex.h \
|
$$PWD/sqliteindex.h \
|
||||||
$$PWD/sqlitebasestatement.h
|
$$PWD/sqlitebasestatement.h
|
||||||
|
|
||||||
DEFINES += SQLITE_THREADSAFE=2 SQLITE_ENABLE_FTS5 SQLITE_ENABLE_UNLOCK_NOTIFY \
|
DEFINES += _HAVE_SQLITE_CONFIG_H SQLITE_CORE
|
||||||
SQLITE_ENABLE_JSON1 SQLITE_DEFAULT_FOREIGN_KEYS=1 SQLITE_TEMP_STORE=2 \
|
|
||||||
SQLITE_DEFAULT_WAL_SYNCHRONOUS=1 SQLITE_MAX_WORKER_THREADS SQLITE_DEFAULT_MEMSTATUS=0 \
|
|
||||||
SQLITE_OMIT_DEPRECATED SQLITE_OMIT_DECLTYPE \
|
|
||||||
SQLITE_MAX_EXPR_DEPTH=0 SQLITE_OMIT_SHARED_CACHE SQLITE_USE_ALLOCA \
|
|
||||||
SQLITE_ENABLE_MEMORY_MANAGEMENT SQLITE_ENABLE_NULL_TRIM SQLITE_OMIT_EXPLAIN \
|
|
||||||
SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_UTF16 SQLITE_DQS=0 \
|
|
||||||
SQLITE_ENABLE_STAT4 HAVE_ISNAN HAVE_FDATASYNC HAVE_MALLOC_USABLE_SIZE \
|
|
||||||
SQLITE_DEFAULT_MMAP_SIZE=268435456 SQLITE_CORE SQLITE_ENABLE_SESSION SQLITE_ENABLE_PREUPDATE_HOOK \
|
|
||||||
SQLITE_LIKE_DOESNT_MATCH_BLOBS
|
|
||||||
|
|
||||||
CONFIG(debug, debug|release): DEFINES += SQLITE_ENABLE_API_ARMOR
|
CONFIG(debug, debug|release): DEFINES += SQLITE_ENABLE_API_ARMOR
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
#include "sqlitedatabasebackend.h"
|
#include "sqlitedatabasebackend.h"
|
||||||
#include "sqliteexception.h"
|
#include "sqliteexception.h"
|
||||||
|
|
||||||
#include "sqlite3.h"
|
#include "sqlite.h"
|
||||||
|
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
@@ -29,7 +29,6 @@
|
|||||||
|
|
||||||
#include "sqliteblob.h"
|
#include "sqliteblob.h"
|
||||||
#include "sqliteexception.h"
|
#include "sqliteexception.h"
|
||||||
#include "sqlitetransaction.h"
|
|
||||||
#include "sqlitevalue.h"
|
#include "sqlitevalue.h"
|
||||||
|
|
||||||
#include <utils/smallstringvector.h>
|
#include <utils/smallstringvector.h>
|
||||||
@@ -38,7 +37,6 @@
|
|||||||
#include <utils/span.h>
|
#include <utils/span.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <exception>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
@@ -93,7 +91,6 @@ public:
|
|||||||
void bind(int index, Utils::span<const char *> values);
|
void bind(int index, Utils::span<const char *> values);
|
||||||
void bind(int index, Utils::SmallStringView value);
|
void bind(int index, Utils::SmallStringView value);
|
||||||
void bind(int index, const Value &value);
|
void bind(int index, const Value &value);
|
||||||
void bind(int index, ValueView value);
|
|
||||||
void bind(int index, BlobView blobView);
|
void bind(int index, BlobView blobView);
|
||||||
|
|
||||||
void bind(int index, uint value) { bind(index, static_cast<long long>(value)); }
|
void bind(int index, uint value) { bind(index, static_cast<long long>(value)); }
|
||||||
@@ -165,14 +162,13 @@ extern template SQLITE_EXPORT Utils::PathString BaseStatement::fetchValue<Utils:
|
|||||||
template<typename BaseStatement, int ResultCount>
|
template<typename BaseStatement, int ResultCount>
|
||||||
class StatementImplementation : public BaseStatement
|
class StatementImplementation : public BaseStatement
|
||||||
{
|
{
|
||||||
struct Resetter;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using BaseStatement::BaseStatement;
|
using BaseStatement::BaseStatement;
|
||||||
|
|
||||||
void execute()
|
void execute()
|
||||||
{
|
{
|
||||||
Resetter resetter{this};
|
Resetter resetter{*this};
|
||||||
BaseStatement::next();
|
BaseStatement::next();
|
||||||
resetter.reset();
|
resetter.reset();
|
||||||
}
|
}
|
||||||
@@ -182,14 +178,15 @@ public:
|
|||||||
template<typename... ValueType>
|
template<typename... ValueType>
|
||||||
void bindValues(const ValueType&... values)
|
void bindValues(const ValueType&... values)
|
||||||
{
|
{
|
||||||
bindValuesByIndex(1, values...);
|
int index = 0;
|
||||||
|
(BaseStatement::bind(++index, values), ...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... ValueType>
|
template<typename... ValueType>
|
||||||
void write(const ValueType&... values)
|
void write(const ValueType&... values)
|
||||||
{
|
{
|
||||||
Resetter resetter{this};
|
Resetter resetter{*this};
|
||||||
bindValuesByIndex(1, values...);
|
bindValues(values...);
|
||||||
BaseStatement::next();
|
BaseStatement::next();
|
||||||
resetter.reset();
|
resetter.reset();
|
||||||
}
|
}
|
||||||
@@ -197,7 +194,7 @@ public:
|
|||||||
template<typename ResultType>
|
template<typename ResultType>
|
||||||
std::vector<ResultType> values(std::size_t reserveSize)
|
std::vector<ResultType> values(std::size_t reserveSize)
|
||||||
{
|
{
|
||||||
Resetter resetter{this};
|
Resetter resetter{*this};
|
||||||
std::vector<ResultType> resultValues;
|
std::vector<ResultType> resultValues;
|
||||||
resultValues.reserve(std::max(reserveSize, m_maximumResultCount));
|
resultValues.reserve(std::max(reserveSize, m_maximumResultCount));
|
||||||
|
|
||||||
@@ -214,7 +211,7 @@ public:
|
|||||||
template<typename ResultType, typename... QueryTypes>
|
template<typename ResultType, typename... QueryTypes>
|
||||||
auto values(std::size_t reserveSize, const QueryTypes &...queryValues)
|
auto values(std::size_t reserveSize, const QueryTypes &...queryValues)
|
||||||
{
|
{
|
||||||
Resetter resetter{this};
|
Resetter resetter{*this};
|
||||||
std::vector<ResultType> resultValues;
|
std::vector<ResultType> resultValues;
|
||||||
resultValues.reserve(std::max(reserveSize, m_maximumResultCount));
|
resultValues.reserve(std::max(reserveSize, m_maximumResultCount));
|
||||||
|
|
||||||
@@ -233,13 +230,13 @@ public:
|
|||||||
template<typename ResultType, typename... QueryTypes>
|
template<typename ResultType, typename... QueryTypes>
|
||||||
auto value(const QueryTypes &...queryValues)
|
auto value(const QueryTypes &...queryValues)
|
||||||
{
|
{
|
||||||
Resetter resetter{this};
|
Resetter resetter{*this};
|
||||||
Utils::optional<ResultType> resultValue;
|
Utils::optional<ResultType> resultValue;
|
||||||
|
|
||||||
bindValues(queryValues...);
|
bindValues(queryValues...);
|
||||||
|
|
||||||
if (BaseStatement::next())
|
if (BaseStatement::next())
|
||||||
resultValue = createOptionalValue<Utils::optional<ResultType>>();
|
resultValue = assignValue<Utils::optional<ResultType>>();
|
||||||
|
|
||||||
resetter.reset();
|
resetter.reset();
|
||||||
|
|
||||||
@@ -261,7 +258,7 @@ public:
|
|||||||
template<typename Callable, typename... QueryTypes>
|
template<typename Callable, typename... QueryTypes>
|
||||||
void readCallback(Callable &&callable, const QueryTypes &...queryValues)
|
void readCallback(Callable &&callable, const QueryTypes &...queryValues)
|
||||||
{
|
{
|
||||||
Resetter resetter{this};
|
Resetter resetter{*this};
|
||||||
|
|
||||||
bindValues(queryValues...);
|
bindValues(queryValues...);
|
||||||
|
|
||||||
@@ -275,10 +272,10 @@ public:
|
|||||||
resetter.reset();
|
resetter.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Container, typename... QueryTypes>
|
template<int ResultTypeCount = 1, typename Container, typename... QueryTypes>
|
||||||
void readTo(Container &container, const QueryTypes &...queryValues)
|
void readTo(Container &container, const QueryTypes &...queryValues)
|
||||||
{
|
{
|
||||||
Resetter resetter{this};
|
Resetter resetter{*this};
|
||||||
|
|
||||||
bindValues(queryValues...);
|
bindValues(queryValues...);
|
||||||
|
|
||||||
@@ -288,187 +285,39 @@ public:
|
|||||||
resetter.reset();
|
resetter.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ResultType, typename... QueryTypes>
|
|
||||||
auto range(const QueryTypes &...queryValues)
|
|
||||||
{
|
|
||||||
return SqliteResultRange<ResultType>{*this, queryValues...};
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename ResultType, typename... QueryTypes>
|
|
||||||
auto rangeWithTransaction(const QueryTypes &...queryValues)
|
|
||||||
{
|
|
||||||
return SqliteResultRangeWithTransaction<ResultType>{*this, queryValues...};
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename ResultType>
|
|
||||||
class BaseSqliteResultRange
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
class SqliteResultIteratator
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
using iterator_category = std::input_iterator_tag;
|
|
||||||
using difference_type = int;
|
|
||||||
using value_type = ResultType;
|
|
||||||
using pointer = ResultType *;
|
|
||||||
using reference = ResultType &;
|
|
||||||
|
|
||||||
SqliteResultIteratator(StatementImplementation &statement)
|
|
||||||
: m_statement{statement}
|
|
||||||
, m_hasNext{m_statement.next()}
|
|
||||||
{}
|
|
||||||
|
|
||||||
SqliteResultIteratator(StatementImplementation &statement, bool hasNext)
|
|
||||||
: m_statement{statement}
|
|
||||||
, m_hasNext{hasNext}
|
|
||||||
{}
|
|
||||||
|
|
||||||
SqliteResultIteratator &operator++()
|
|
||||||
{
|
|
||||||
m_hasNext = m_statement.next();
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator++(int) { m_hasNext = m_statement.next(); }
|
|
||||||
|
|
||||||
friend bool operator==(const SqliteResultIteratator &first,
|
|
||||||
const SqliteResultIteratator &second)
|
|
||||||
{
|
|
||||||
return first.m_hasNext == second.m_hasNext;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator!=(const SqliteResultIteratator &first,
|
|
||||||
const SqliteResultIteratator &second)
|
|
||||||
{
|
|
||||||
return !(first == second);
|
|
||||||
}
|
|
||||||
|
|
||||||
value_type operator*() const { return m_statement.createValue<ResultType>(); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
StatementImplementation &m_statement;
|
|
||||||
bool m_hasNext = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
using value_type = ResultType;
|
|
||||||
using iterator = SqliteResultIteratator;
|
|
||||||
using const_iterator = iterator;
|
|
||||||
|
|
||||||
template<typename... QueryTypes>
|
|
||||||
BaseSqliteResultRange(StatementImplementation &statement, const QueryTypes &...queryValues)
|
|
||||||
: m_statement{statement}
|
|
||||||
{
|
|
||||||
statement.bindValues(queryValues...);
|
|
||||||
}
|
|
||||||
|
|
||||||
BaseSqliteResultRange(BaseSqliteResultRange &) = delete;
|
|
||||||
BaseSqliteResultRange &operator=(BaseSqliteResultRange &) = delete;
|
|
||||||
|
|
||||||
BaseSqliteResultRange(BaseSqliteResultRange &&other)
|
|
||||||
: m_statement{std::move(other.resetter)}
|
|
||||||
{}
|
|
||||||
BaseSqliteResultRange &operator=(BaseSqliteResultRange &&) = delete;
|
|
||||||
|
|
||||||
iterator begin() & { return iterator{m_statement}; }
|
|
||||||
iterator end() & { return iterator{m_statement, false}; }
|
|
||||||
|
|
||||||
const_iterator begin() const & { return iterator{m_statement}; }
|
|
||||||
const_iterator end() const & { return iterator{m_statement, false}; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
StatementImplementation &m_statement;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename ResultType>
|
|
||||||
class SqliteResultRange : public BaseSqliteResultRange<ResultType>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
template<typename... QueryTypes>
|
|
||||||
SqliteResultRange(StatementImplementation &statement, const QueryTypes &...queryValues)
|
|
||||||
: BaseSqliteResultRange<ResultType>{statement}
|
|
||||||
, resetter{&statement}
|
|
||||||
|
|
||||||
{
|
|
||||||
statement.bindValues(queryValues...);
|
|
||||||
}
|
|
||||||
|
|
||||||
~SqliteResultRange()
|
|
||||||
{
|
|
||||||
if (!std::uncaught_exceptions())
|
|
||||||
resetter.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
Resetter resetter;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename ResultType>
|
|
||||||
class SqliteResultRangeWithTransaction : public BaseSqliteResultRange<ResultType>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
template<typename... QueryTypes>
|
|
||||||
SqliteResultRangeWithTransaction(StatementImplementation &statement,
|
|
||||||
const QueryTypes &...queryValues)
|
|
||||||
: BaseSqliteResultRange<ResultType>{statement}
|
|
||||||
, m_transaction{statement.database()}
|
|
||||||
, resetter{&statement}
|
|
||||||
{
|
|
||||||
statement.bindValues(queryValues...);
|
|
||||||
}
|
|
||||||
|
|
||||||
~SqliteResultRangeWithTransaction()
|
|
||||||
{
|
|
||||||
if (!std::uncaught_exceptions()) {
|
|
||||||
resetter.reset();
|
|
||||||
m_transaction.commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
DeferredTransaction m_transaction;
|
|
||||||
Resetter resetter;
|
|
||||||
};
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~StatementImplementation() = default;
|
~StatementImplementation() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Resetter
|
struct Resetter
|
||||||
{
|
{
|
||||||
Resetter(StatementImplementation *statement)
|
Resetter(StatementImplementation &statement)
|
||||||
: statement(statement)
|
: statement(statement)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Resetter(Resetter &) = delete;
|
|
||||||
Resetter &operator=(Resetter &) = delete;
|
|
||||||
|
|
||||||
Resetter(Resetter &&other)
|
|
||||||
: statement{std::exchange(other.statement, nullptr)}
|
|
||||||
{}
|
|
||||||
|
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (statement)
|
statement.reset();
|
||||||
statement->reset();
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
statement = nullptr;
|
shouldReset = false;
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
statement = nullptr;
|
shouldReset = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
~Resetter() noexcept
|
~Resetter() noexcept
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (statement)
|
if (shouldReset)
|
||||||
statement->reset();
|
statement.reset();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StatementImplementation *statement;
|
StatementImplementation &statement;
|
||||||
|
bool shouldReset = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ValueGetter
|
struct ValueGetter
|
||||||
@@ -490,11 +339,6 @@ private:
|
|||||||
int column;
|
int column;
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr int resultCount(int localResultCount) const
|
|
||||||
{
|
|
||||||
return ResultCount < 0 ? localResultCount : ResultCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename ContainerType, int... ColumnIndices>
|
template<typename ContainerType, int... ColumnIndices>
|
||||||
void emplaceBackValues(ContainerType &container, std::integer_sequence<int, ColumnIndices...>)
|
void emplaceBackValues(ContainerType &container, std::integer_sequence<int, ColumnIndices...>)
|
||||||
{
|
{
|
||||||
@@ -507,28 +351,17 @@ private:
|
|||||||
emplaceBackValues(container, std::make_integer_sequence<int, ResultCount>{});
|
emplaceBackValues(container, std::make_integer_sequence<int, ResultCount>{});
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ResultOptionalType, int... ColumnIndices>
|
template <typename ResultOptionalType,
|
||||||
ResultOptionalType createOptionalValue(std::integer_sequence<int, ColumnIndices...>)
|
int... ColumnIndices>
|
||||||
|
ResultOptionalType assignValue(std::integer_sequence<int, ColumnIndices...>)
|
||||||
{
|
{
|
||||||
return ResultOptionalType(Utils::in_place, ValueGetter(*this, ColumnIndices)...);
|
return ResultOptionalType(Utils::in_place, ValueGetter(*this, ColumnIndices)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ResultOptionalType>
|
template<typename ResultOptionalType>
|
||||||
ResultOptionalType createOptionalValue()
|
ResultOptionalType assignValue()
|
||||||
{
|
{
|
||||||
return createOptionalValue<ResultOptionalType>(std::make_integer_sequence<int, ResultCount>{});
|
return assignValue<ResultOptionalType>(std::make_integer_sequence<int, ResultCount>{});
|
||||||
}
|
|
||||||
|
|
||||||
template<typename ResultType, int... ColumnIndices>
|
|
||||||
ResultType createValue(std::integer_sequence<int, ColumnIndices...>)
|
|
||||||
{
|
|
||||||
return ResultType{ValueGetter(*this, ColumnIndices)...};
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename ResultType>
|
|
||||||
ResultType createValue()
|
|
||||||
{
|
|
||||||
return createValue<ResultType>(std::make_integer_sequence<int, ResultCount>{});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Callable, int... ColumnIndices>
|
template<typename Callable, int... ColumnIndices>
|
||||||
@@ -543,19 +376,6 @@ private:
|
|||||||
return callCallable(callable, std::make_integer_sequence<int, ResultCount>{});
|
return callCallable(callable, std::make_integer_sequence<int, ResultCount>{});
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ValueType>
|
|
||||||
void bindValuesByIndex(int index, const ValueType &value)
|
|
||||||
{
|
|
||||||
BaseStatement::bind(index, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename ValueType, typename... ValueTypes>
|
|
||||||
void bindValuesByIndex(int index, const ValueType &value, const ValueTypes &...values)
|
|
||||||
{
|
|
||||||
BaseStatement::bind(index, value);
|
|
||||||
bindValuesByIndex(index + 1, values...);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setMaximumResultCount(std::size_t count)
|
void setMaximumResultCount(std::size_t count)
|
||||||
{
|
{
|
||||||
m_maximumResultCount = std::max(m_maximumResultCount, count);
|
m_maximumResultCount = std::max(m_maximumResultCount, count);
|
||||||
|
@@ -39,7 +39,7 @@ public:
|
|||||||
|
|
||||||
Column(Utils::SmallStringView tableName,
|
Column(Utils::SmallStringView tableName,
|
||||||
Utils::SmallStringView name,
|
Utils::SmallStringView name,
|
||||||
ColumnType type,
|
ColumnType type = ColumnType::None,
|
||||||
Constraints &&constraints = {})
|
Constraints &&constraints = {})
|
||||||
: constraints(std::move(constraints))
|
: constraints(std::move(constraints))
|
||||||
, name(name)
|
, name(name)
|
||||||
|
@@ -35,7 +35,7 @@
|
|||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "sqlite3.h"
|
#include "sqlite.h"
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
namespace Sqlite {
|
namespace Sqlite {
|
||||||
|
|
||||||
enum class ColumnType : char { Numeric, Integer, Real, Text, Blob, None };
|
enum class ColumnType : char { None, Numeric, Integer, Real, Text, Blob };
|
||||||
|
|
||||||
enum class ConstraintType : char { NoConstraint, PrimaryKey, Unique, ForeignKey };
|
enum class ConstraintType : char { NoConstraint, PrimaryKey, Unique, ForeignKey };
|
||||||
|
|
||||||
|
47
src/libs/sqlite/sqlitelibraryinitializer.cpp
Normal file
47
src/libs/sqlite/sqlitelibraryinitializer.cpp
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3 as published by the Free Software
|
||||||
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "sqlitelibraryinitializer.h"
|
||||||
|
|
||||||
|
#include "sqlitedatabasebackend.h"
|
||||||
|
|
||||||
|
namespace Sqlite {
|
||||||
|
|
||||||
|
void LibraryInitializer::initialize()
|
||||||
|
{
|
||||||
|
static LibraryInitializer initializer;
|
||||||
|
}
|
||||||
|
|
||||||
|
LibraryInitializer::LibraryInitializer()
|
||||||
|
{
|
||||||
|
DatabaseBackend::initializeSqliteLibrary();
|
||||||
|
}
|
||||||
|
|
||||||
|
LibraryInitializer::~LibraryInitializer()
|
||||||
|
{
|
||||||
|
DatabaseBackend::shutdownSqliteLibrary();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Sqlite
|
42
src/libs/sqlite/sqlitelibraryinitializer.h
Normal file
42
src/libs/sqlite/sqlitelibraryinitializer.h
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3 as published by the Free Software
|
||||||
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "sqliteglobal.h"
|
||||||
|
|
||||||
|
namespace Sqlite {
|
||||||
|
|
||||||
|
class LibraryInitializer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SQLITE_EXPORT static void initialize();
|
||||||
|
|
||||||
|
private:
|
||||||
|
LibraryInitializer();
|
||||||
|
~LibraryInitializer();
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Sqlite
|
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include <utils/smallstringio.h>
|
#include <utils/smallstringio.h>
|
||||||
|
|
||||||
#include <sqlite3ext.h>
|
#include <sqlite.h>
|
||||||
|
|
||||||
namespace Sqlite {
|
namespace Sqlite {
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include "sqlitesessionchangeset.h"
|
#include "sqlitesessionchangeset.h"
|
||||||
#include "sqlitetable.h"
|
#include "sqlitetable.h"
|
||||||
|
|
||||||
#include <sqlite3ext.h>
|
#include <sqlite.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
@@ -72,7 +72,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
Column &addColumn(Utils::SmallStringView name,
|
Column &addColumn(Utils::SmallStringView name,
|
||||||
ColumnType type = ColumnType::Numeric,
|
ColumnType type = ColumnType::None,
|
||||||
Constraints &&constraints = {})
|
Constraints &&constraints = {})
|
||||||
{
|
{
|
||||||
m_sqliteColumns.emplace_back(m_tableName, name, type, std::move(constraints));
|
m_sqliteColumns.emplace_back(m_tableName, name, type, std::move(constraints));
|
||||||
|
@@ -179,12 +179,18 @@ bool SqlStatementBuilder::isBuild() const
|
|||||||
Utils::SmallString SqlStatementBuilder::columnTypeToString(ColumnType columnType)
|
Utils::SmallString SqlStatementBuilder::columnTypeToString(ColumnType columnType)
|
||||||
{
|
{
|
||||||
switch (columnType) {
|
switch (columnType) {
|
||||||
case ColumnType::Numeric: return "NUMERIC";
|
case ColumnType::Numeric:
|
||||||
case ColumnType::Integer: return "INTEGER";
|
return " NUMERIC";
|
||||||
case ColumnType::Real: return "REAL";
|
case ColumnType::Integer:
|
||||||
case ColumnType::Text: return "TEXT";
|
return " INTEGER";
|
||||||
case ColumnType::Blob: return "BLOB";
|
case ColumnType::Real:
|
||||||
case ColumnType::None: return {};
|
return " REAL";
|
||||||
|
case ColumnType::Text:
|
||||||
|
return " TEXT";
|
||||||
|
case ColumnType::Blob:
|
||||||
|
return " BLOB";
|
||||||
|
case ColumnType::None:
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
|
@@ -49,6 +49,7 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/iversioncontrol.h>
|
#include <coreplugin/iversioncontrol.h>
|
||||||
#include <coreplugin/vcsmanager.h>
|
#include <coreplugin/vcsmanager.h>
|
||||||
|
#include <coreplugin/editormanager/documentmodel.h>
|
||||||
|
|
||||||
#include <projectexplorer/buildmanager.h>
|
#include <projectexplorer/buildmanager.h>
|
||||||
#include <projectexplorer/kitmanager.h>
|
#include <projectexplorer/kitmanager.h>
|
||||||
@@ -1073,6 +1074,23 @@ QStringList Project::availableQmlPreviewTranslations(QString *errorMessage)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<Core::IDocument *> Project::modifiedDocuments() const
|
||||||
|
{
|
||||||
|
QList<Core::IDocument *> modifiedProjectDocuments;
|
||||||
|
|
||||||
|
for (Core::IDocument *doc : Core::DocumentModel::openedDocuments()) {
|
||||||
|
if (doc->isModified() && isKnownFile(doc->filePath()))
|
||||||
|
modifiedProjectDocuments.append(doc);
|
||||||
|
}
|
||||||
|
|
||||||
|
return modifiedProjectDocuments;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Project::isModified() const
|
||||||
|
{
|
||||||
|
return !modifiedDocuments().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(WITH_TESTS)
|
#if defined(WITH_TESTS)
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
@@ -185,6 +185,9 @@ public:
|
|||||||
|
|
||||||
QStringList availableQmlPreviewTranslations(QString *errorMessage);
|
QStringList availableQmlPreviewTranslations(QString *errorMessage);
|
||||||
|
|
||||||
|
QList<Core::IDocument *> modifiedDocuments() const;
|
||||||
|
bool isModified() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void projectFileIsDirty(const Utils::FilePath &path);
|
void projectFileIsDirty(const Utils::FilePath &path);
|
||||||
|
|
||||||
|
@@ -25,22 +25,23 @@
|
|||||||
|
|
||||||
#include "quick2propertyeditorview.h"
|
#include "quick2propertyeditorview.h"
|
||||||
|
|
||||||
#include "propertyeditorvalue.h"
|
#include "aligndistribute.h"
|
||||||
|
#include "annotationeditor/annotationeditor.h"
|
||||||
|
#include "bindingeditor/actioneditor.h"
|
||||||
|
#include "bindingeditor/bindingeditor.h"
|
||||||
#include "fileresourcesmodel.h"
|
#include "fileresourcesmodel.h"
|
||||||
#include "gradientmodel.h"
|
#include "gradientmodel.h"
|
||||||
#include "gradientpresetdefaultlistmodel.h"
|
|
||||||
#include "gradientpresetcustomlistmodel.h"
|
#include "gradientpresetcustomlistmodel.h"
|
||||||
|
#include "gradientpresetdefaultlistmodel.h"
|
||||||
#include "itemfiltermodel.h"
|
#include "itemfiltermodel.h"
|
||||||
#include "simplecolorpalettemodel.h"
|
|
||||||
#include "bindingeditor/bindingeditor.h"
|
|
||||||
#include "bindingeditor/actioneditor.h"
|
|
||||||
#include "annotationeditor/annotationeditor.h"
|
|
||||||
#include "qmlanchorbindingproxy.h"
|
|
||||||
#include "theme.h"
|
|
||||||
#include "aligndistribute.h"
|
|
||||||
#include "propertyeditorcontextobject.h"
|
#include "propertyeditorcontextobject.h"
|
||||||
#include "tooltip.h"
|
#include "propertyeditorqmlbackend.h"
|
||||||
|
#include "propertyeditorvalue.h"
|
||||||
|
#include "qmlanchorbindingproxy.h"
|
||||||
#include "richtexteditor/richtexteditorproxy.h"
|
#include "richtexteditor/richtexteditorproxy.h"
|
||||||
|
#include "simplecolorpalettemodel.h"
|
||||||
|
#include "theme.h"
|
||||||
|
#include "tooltip.h"
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
@@ -71,6 +72,11 @@ void Quick2PropertyEditorView::registerQmlTypes()
|
|||||||
Tooltip::registerDeclarativeType();
|
Tooltip::registerDeclarativeType();
|
||||||
EasingCurveEditor::registerDeclarativeType();
|
EasingCurveEditor::registerDeclarativeType();
|
||||||
RichTextEditorProxy::registerDeclarativeType();
|
RichTextEditorProxy::registerDeclarativeType();
|
||||||
|
QUrl regExpUrl = QUrl::fromLocalFile(PropertyEditorQmlBackend::propertyEditorResourcesPath()
|
||||||
|
+ "/RegExpValidator.qml");
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
qmlRegisterType(regExpUrl, "HelperWidgets", 2, 0, "RegExpValidator");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -66,8 +66,4 @@ private:
|
|||||||
mutable QVariant m_value;
|
mutable QVariant m_value;
|
||||||
};
|
};
|
||||||
|
|
||||||
QMLDESIGNERCORE_EXPORT QDataStream &operator<<(QDataStream &stream, const QList<PropertyContainer> &propertyContainerList);
|
|
||||||
QMLDESIGNERCORE_EXPORT QDataStream &operator>>(QDataStream &stream, QList<PropertyContainer> &propertyContainerList);
|
|
||||||
QMLDESIGNERCORE_EXPORT QDebug operator<<(QDebug debug, QList<PropertyContainer> &propertyContainerList);
|
|
||||||
|
|
||||||
} //namespace QmlDesigner
|
} //namespace QmlDesigner
|
||||||
|
@@ -203,7 +203,7 @@ static bool isIdToAvoid(const QString& id)
|
|||||||
|
|
||||||
static bool idContainsWrongLetter(const QString& id)
|
static bool idContainsWrongLetter(const QString& id)
|
||||||
{
|
{
|
||||||
static QRegularExpression idExpr(QStringLiteral("^[a-z_][a-zA-Z0-9_]+$"));
|
static QRegularExpression idExpr(QStringLiteral("^[a-z_][a-zA-Z0-9_]*$"));
|
||||||
return !id.contains(idExpr);
|
return !id.contains(idExpr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -113,37 +113,5 @@ QDebug operator<<(QDebug debug, const PropertyContainer &propertyContainer)
|
|||||||
return debug.space();
|
return debug.space();
|
||||||
}
|
}
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &stream, const QList<PropertyContainer> &propertyContainerList)
|
|
||||||
{
|
|
||||||
stream << propertyContainerList.count();
|
|
||||||
foreach (const PropertyContainer &propertyContainer, propertyContainerList)
|
|
||||||
stream << propertyContainer;
|
|
||||||
|
|
||||||
return stream;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDataStream &operator>>(QDataStream &stream, QList<PropertyContainer> &propertyContainerList)
|
|
||||||
{
|
|
||||||
int count;
|
|
||||||
stream >> count;
|
|
||||||
Q_ASSERT(count >= 0);
|
|
||||||
for ( int i = 0; i < count; i++) {
|
|
||||||
PropertyContainer propertyContainer;
|
|
||||||
stream >> propertyContainer;
|
|
||||||
propertyContainerList.append(propertyContainer);
|
|
||||||
}
|
|
||||||
|
|
||||||
return stream;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, QList<PropertyContainer> &propertyContainerList)
|
|
||||||
{
|
|
||||||
foreach (const PropertyContainer &propertyContainer, propertyContainerList)
|
|
||||||
debug << propertyContainer;
|
|
||||||
|
|
||||||
return debug.space();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} //namespace QmlDesigner
|
} //namespace QmlDesigner
|
||||||
|
|
||||||
|
@@ -55,18 +55,19 @@
|
|||||||
#include <coreplugin/actionmanager/command.h>
|
#include <coreplugin/actionmanager/command.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/designmode.h>
|
#include <coreplugin/designmode.h>
|
||||||
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/idocument.h>
|
#include <coreplugin/idocument.h>
|
||||||
#include <coreplugin/messagebox.h>
|
#include <coreplugin/messagebox.h>
|
||||||
#include <coreplugin/modemanager.h>
|
#include <coreplugin/modemanager.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <extensionsystem/pluginspec.h>
|
#include <extensionsystem/pluginspec.h>
|
||||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
|
#include <projectexplorer/target.h>
|
||||||
|
#include <sqlitelibraryinitializer.h>
|
||||||
|
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||||
|
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -211,7 +212,9 @@ QmlDesignerPlugin::~QmlDesignerPlugin()
|
|||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
bool QmlDesignerPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage/* = 0*/)
|
bool QmlDesignerPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage/* = 0*/)
|
||||||
{
|
{
|
||||||
QDir{}.mkpath(Core::ICore::cacheResourcePath().toString());
|
Sqlite::LibraryInitializer::initialize();
|
||||||
|
|
||||||
|
QDir{}.mkpath(Core::ICore::cacheResourcePath());
|
||||||
|
|
||||||
if (!Utils::HostOsInfo::canCreateOpenGLContext(errorMessage))
|
if (!Utils::HostOsInfo::canCreateOpenGLContext(errorMessage))
|
||||||
return false;
|
return false;
|
||||||
@@ -219,10 +222,8 @@ bool QmlDesignerPlugin::initialize(const QStringList & /*arguments*/, QString *e
|
|||||||
if (DesignerSettings::getValue(DesignerSettingsKey::STANDALONE_MODE).toBool())
|
if (DesignerSettings::getValue(DesignerSettingsKey::STANDALONE_MODE).toBool())
|
||||||
GenerateResource::generateMenuEntry();
|
GenerateResource::generateMenuEntry();
|
||||||
|
|
||||||
const QString fontPath
|
QString fontPath = Core::ICore::resourcePath() +
|
||||||
= Core::ICore::resourcePath(
|
QStringLiteral("/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf");
|
||||||
"qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf")
|
|
||||||
.toString();
|
|
||||||
if (QFontDatabase::addApplicationFont(fontPath) < 0)
|
if (QFontDatabase::addApplicationFont(fontPath) < 0)
|
||||||
qCWarning(qmldesignerLog) << "Could not add font " << fontPath << "to font database";
|
qCWarning(qmldesignerLog) << "Could not add font " << fontPath << "to font database";
|
||||||
|
|
||||||
|
@@ -26,6 +26,8 @@
|
|||||||
#include "qmldebugtranslationclient.h"
|
#include "qmldebugtranslationclient.h"
|
||||||
#include <qmldebug/qpacketprotocol.h>
|
#include <qmldebug/qpacketprotocol.h>
|
||||||
|
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
#ifdef FOUND_QML_DEBUG_TRANSLATION_PROTOCOL
|
#ifdef FOUND_QML_DEBUG_TRANSLATION_PROTOCOL
|
||||||
#include <private/qqmldebugtranslationprotocol_p.h>
|
#include <private/qqmldebugtranslationprotocol_p.h>
|
||||||
#endif
|
#endif
|
||||||
|
@@ -407,7 +407,7 @@ void CodeAssistantPrivate::finalizeProposal()
|
|||||||
|
|
||||||
bool CodeAssistantPrivate::isDisplayingProposal() const
|
bool CodeAssistantPrivate::isDisplayingProposal() const
|
||||||
{
|
{
|
||||||
return m_proposalWidget != nullptr && m_proposalWidget->isVisible();
|
return m_proposalWidget != nullptr && m_proposalWidget->proposalIsVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CodeAssistantPrivate::isWaitingForProposal() const
|
bool CodeAssistantPrivate::isWaitingForProposal() const
|
||||||
|
@@ -219,10 +219,15 @@ void FunctionHintProposalWidget::closeProposal()
|
|||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FunctionHintProposalWidget::proposalIsVisible() const
|
||||||
|
{
|
||||||
|
return d->m_popupFrame->isVisible();
|
||||||
|
}
|
||||||
|
|
||||||
void FunctionHintProposalWidget::abort()
|
void FunctionHintProposalWidget::abort()
|
||||||
{
|
{
|
||||||
qApp->removeEventFilter(this);
|
qApp->removeEventFilter(this);
|
||||||
if (d->m_popupFrame->isVisible())
|
if (proposalIsVisible())
|
||||||
d->m_popupFrame->close();
|
d->m_popupFrame->close();
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
|
@@ -52,6 +52,8 @@ public:
|
|||||||
void updateProposal(const QString &prefix) override;
|
void updateProposal(const QString &prefix) override;
|
||||||
void closeProposal() override;
|
void closeProposal() override;
|
||||||
|
|
||||||
|
bool proposalIsVisible() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *o, QEvent *e) override;
|
bool eventFilter(QObject *o, QEvent *e) override;
|
||||||
|
|
||||||
|
@@ -57,6 +57,8 @@ public:
|
|||||||
virtual void updateProposal(const QString &prefix) = 0;
|
virtual void updateProposal(const QString &prefix) = 0;
|
||||||
virtual void closeProposal() = 0;
|
virtual void closeProposal() = 0;
|
||||||
|
|
||||||
|
virtual bool proposalIsVisible() const { return isVisible(); }
|
||||||
|
|
||||||
int basePosition() const;
|
int basePosition() const;
|
||||||
void setBasePosition(int basePosition);
|
void setBasePosition(int basePosition);
|
||||||
|
|
||||||
|
@@ -225,6 +225,14 @@ endforeach()
|
|||||||
|
|
||||||
extend_qtc_test_with_target_sources(Sqlite)
|
extend_qtc_test_with_target_sources(Sqlite)
|
||||||
|
|
||||||
|
extend_qtc_test(unittest DEFINES _HAVE_SQLITE_CONFIG_H)
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
extend_qtc_test(unittest DEFINES _BSD_SOURCE)
|
||||||
|
elseif (UNIX)
|
||||||
|
extend_qtc_test(unittest DEFINES _POSIX_C_SOURCE=200809L _GNU_SOURCE _DEFAULT_SOURCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Do not work on the source directory data
|
# Do not work on the source directory data
|
||||||
add_custom_command(TARGET unittest POST_BUILD
|
add_custom_command(TARGET unittest POST_BUILD
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_directory
|
COMMAND "${CMAKE_COMMAND}" -E copy_directory
|
||||||
|
@@ -72,7 +72,7 @@
|
|||||||
#include <variantproperty.h>
|
#include <variantproperty.h>
|
||||||
#include <qmldesigner/designercore/imagecache/imagecachestorageinterface.h>
|
#include <qmldesigner/designercore/imagecache/imagecachestorageinterface.h>
|
||||||
|
|
||||||
#include <sqlite3ext.h>
|
#include <sqlite.h>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
ClangBackEnd::FilePathCaching *filePathCache = nullptr;
|
ClangBackEnd::FilePathCaching *filePathCache = nullptr;
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
#include <sqliteexception.h>
|
#include <sqliteexception.h>
|
||||||
#include <sqlitewritestatement.h>
|
#include <sqlitewritestatement.h>
|
||||||
|
|
||||||
#include <sqlite3.h>
|
#include <sqlite.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
|
@@ -93,7 +93,9 @@ TEST_F(SqliteTable, InitializeTable)
|
|||||||
table.addColumn("name");
|
table.addColumn("name");
|
||||||
table.addColumn("value");
|
table.addColumn("value");
|
||||||
|
|
||||||
EXPECT_CALL(databaseMock, execute(Eq("CREATE TEMPORARY TABLE IF NOT EXISTS testTable(name NUMERIC, value NUMERIC) WITHOUT ROWID")));
|
EXPECT_CALL(databaseMock,
|
||||||
|
execute(Eq(
|
||||||
|
"CREATE TEMPORARY TABLE IF NOT EXISTS testTable(name, value) WITHOUT ROWID")));
|
||||||
|
|
||||||
table.initialize(databaseMock);
|
table.initialize(databaseMock);
|
||||||
}
|
}
|
||||||
@@ -107,7 +109,7 @@ TEST_F(SqliteTable, InitializeTableWithIndex)
|
|||||||
table.addIndex({column});
|
table.addIndex({column});
|
||||||
table.addIndex({column2});
|
table.addIndex({column2});
|
||||||
|
|
||||||
EXPECT_CALL(databaseMock, execute(Eq("CREATE TABLE testTable(name NUMERIC, value NUMERIC)")));
|
EXPECT_CALL(databaseMock, execute(Eq("CREATE TABLE testTable(name, value)")));
|
||||||
EXPECT_CALL(databaseMock, execute(Eq("CREATE INDEX IF NOT EXISTS index_testTable_name ON testTable(name)")));
|
EXPECT_CALL(databaseMock, execute(Eq("CREATE INDEX IF NOT EXISTS index_testTable_name ON testTable(name)")));
|
||||||
EXPECT_CALL(databaseMock, execute(Eq("CREATE INDEX IF NOT EXISTS index_testTable_value ON testTable(value)")));
|
EXPECT_CALL(databaseMock, execute(Eq("CREATE INDEX IF NOT EXISTS index_testTable_value ON testTable(value)")));
|
||||||
|
|
||||||
@@ -299,9 +301,7 @@ TEST_F(SqliteTable, AddPrimaryTableContraint)
|
|||||||
const auto &nameColumn = table.addColumn("name");
|
const auto &nameColumn = table.addColumn("name");
|
||||||
table.addPrimaryKeyContraint({idColumn, nameColumn});
|
table.addPrimaryKeyContraint({idColumn, nameColumn});
|
||||||
|
|
||||||
EXPECT_CALL(databaseMock,
|
EXPECT_CALL(databaseMock, execute(Eq("CREATE TABLE testTable(id, name, PRIMARY KEY(id, name))")));
|
||||||
execute(
|
|
||||||
Eq("CREATE TABLE testTable(id NUMERIC, name NUMERIC, PRIMARY KEY(id, name))")));
|
|
||||||
|
|
||||||
table.initialize(databaseMock);
|
table.initialize(databaseMock);
|
||||||
}
|
}
|
||||||
|
@@ -137,11 +137,11 @@ TEST(SqlStatementBuilder, ClearBinding)
|
|||||||
|
|
||||||
TEST(SqlStatementBuilder, ColumnType)
|
TEST(SqlStatementBuilder, ColumnType)
|
||||||
{
|
{
|
||||||
ASSERT_THAT(SqlStatementBuilder::columnTypeToString(ColumnType::Numeric), "NUMERIC");
|
ASSERT_THAT(SqlStatementBuilder::columnTypeToString(ColumnType::Numeric), " NUMERIC");
|
||||||
ASSERT_THAT(SqlStatementBuilder::columnTypeToString(ColumnType::Integer), "INTEGER");
|
ASSERT_THAT(SqlStatementBuilder::columnTypeToString(ColumnType::Integer), " INTEGER");
|
||||||
ASSERT_THAT(SqlStatementBuilder::columnTypeToString(ColumnType::Real), "REAL");
|
ASSERT_THAT(SqlStatementBuilder::columnTypeToString(ColumnType::Real), " REAL");
|
||||||
ASSERT_THAT(SqlStatementBuilder::columnTypeToString(ColumnType::Text), "TEXT");
|
ASSERT_THAT(SqlStatementBuilder::columnTypeToString(ColumnType::Text), " TEXT");
|
||||||
ASSERT_THAT(SqlStatementBuilder::columnTypeToString(ColumnType::Blob), "BLOB");
|
ASSERT_THAT(SqlStatementBuilder::columnTypeToString(ColumnType::Blob), " BLOB");
|
||||||
ASSERT_TRUE(SqlStatementBuilder::columnTypeToString(ColumnType::None).isEmpty());
|
ASSERT_TRUE(SqlStatementBuilder::columnTypeToString(ColumnType::None).isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -37,6 +37,9 @@ QMAKE_LFLAGS += -fno-merge-debug-strings -fuse-ld=gold
|
|||||||
CONFIG(release, debug|release):QMAKE_LFLAGS += -Wl,--strip-debug
|
CONFIG(release, debug|release):QMAKE_LFLAGS += -Wl,--strip-debug
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CONFIG(debug, debug|release): DEFINES += SQLITE_DEBUG
|
||||||
|
|
||||||
|
|
||||||
gcc:!clang: QMAKE_CXXFLAGS += -Wno-noexcept-type
|
gcc:!clang: QMAKE_CXXFLAGS += -Wno-noexcept-type
|
||||||
msvc{
|
msvc{
|
||||||
QMAKE_CXXFLAGS += /bigobj /wd4267 /wd4141 /wd4146 /wd4624
|
QMAKE_CXXFLAGS += /bigobj /wd4267 /wd4141 /wd4146 /wd4624
|
||||||
|
@@ -26,6 +26,8 @@
|
|||||||
#include "googletest.h"
|
#include "googletest.h"
|
||||||
|
|
||||||
#include <sqlitedatabase.h>
|
#include <sqlitedatabase.h>
|
||||||
|
#include <sqlitelibraryinitializer.h>
|
||||||
|
|
||||||
#include <sqliteglobal.h>
|
#include <sqliteglobal.h>
|
||||||
#include <utils/temporarydirectory.h>
|
#include <utils/temporarydirectory.h>
|
||||||
|
|
||||||
@@ -52,6 +54,7 @@ public:
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
Sqlite::LibraryInitializer::initialize();
|
||||||
Sqlite::Database::activateLogging();
|
Sqlite::Database::activateLogging();
|
||||||
|
|
||||||
QGuiApplication application(argc, argv);
|
QGuiApplication application(argc, argv);
|
||||||
|
Reference in New Issue
Block a user