Skip to content

Commit

Permalink
Removal of QT SQL. Migrate to Sqlite library.
Browse files Browse the repository at this point in the history
  • Loading branch information
awawa-dev committed May 30, 2024
1 parent aa20079 commit 6477c54
Show file tree
Hide file tree
Showing 4 changed files with 271,146 additions and 0 deletions.
45 changes: 45 additions & 0 deletions sources/db/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,48 @@ endif()
if(USE_PRECOMPILED_HEADERS AND COMMAND target_precompile_headers)
target_precompile_headers(database REUSE_FROM precompiled_hyperhdr_headers)
endif()

add_library(sqlite3 "${CURRENT_SOURCE_DIR}/sqlite/sqlite3.c")
target_include_directories(sqlite3 PUBLIC "${CURRENT_SOURCE_DIR}/sqlite")
target_link_libraries(sqlite3 PUBLIC ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
target_link_libraries(database sqlite3)

set_target_properties(sqlite3 PROPERTIES
OUTPUT_NAME sqlite3
PUBLIC_HEADER sqlite3.h
)

target_compile_definitions(sqlite3 PUBLIC
SQLITE_THREADSAFE=2
SQLITE_DEFAULT_MEMSTATUS=0
SQLITE_DEFAULT_SYNCHRONOUS=3
SQLITE_OMIT_AUTHORIZATION
SQLITE_OMIT_AUTOINCREMENT
SQLITE_OMIT_AUTOMATIC_INDEX
SQLITE_OMIT_INCRBLOB
SQLITE_OMIT_AUTORESET
SQLITE_OMIT_AUTOVACUUM
SQLITE_OMIT_BETWEEN_OPTIMIZATION
SQLITE_OMIT_BLOB_LITERAL
SQLITE_OMIT_BTREECOUNT
SQLITE_OMIT_CHECK
SQLITE_OMIT_COMPILEOPTION_DIAGS
SQLITE_OMIT_COMPLETE
SQLITE_OMIT_DEPRECATED
SQLITE_OMIT_FLAG_PRAGMAS
SQLITE_OMIT_EXPLAIN
SQLITE_OMIT_FOREIGN_KEY
SQLITE_OMIT_GET_TABLE
SQLITE_OMIT_LIKE_OPTIMIZATION
SQLITE_OMIT_LOAD_EXTENSION
SQLITE_OMIT_OR_OPTIMIZATION
SQLITE_OMIT_PROGRESS_CALLBACK
SQLITE_OMIT_QUICKBALANCE
SQLITE_OMIT_SCHEMA_PRAGMAS
SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
SQLITE_OMIT_TCL_VARIABLE
SQLITE_OMIT_TEMPDB
SQLITE_OMIT_TRACE
SQLITE_OMIT_TRUNCATE_OPTIMIZATION
SQLITE_OMIT_WAL
SQLITE_OMIT_XFER_OPT)
3 changes: 3 additions & 0 deletions sources/db/DBManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
#include <QFileInfo>
#include <QTextStream>
#include <QIODevice>
#include <iostream>
#include <sqlite3.h>

#include <HyperhdrConfig.h> // Required to determine the cmake options

Expand All @@ -54,6 +56,7 @@ DBManager::DBManager()
: _log(Logger::getInstance("DB"))
, _readonlyMode(false)
{
std::cout << "SQLite version: " << sqlite3_libversion() << std::endl;
}

DBManager::~DBManager()
Expand Down
Loading

0 comments on commit 6477c54

Please sign in to comment.