From 81780683a45ce01de67b5050137a28524cf3c65f Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 5 Feb 2022 15:57:40 +0100 Subject: [PATCH] Moved core/databases to just datatbases. Also fox database module detection login. --- SConstruct | 8 ++++---- core/object.cpp | 2 +- core/settings/db_settings.cpp | 10 +++++----- database/SCsub | 11 +++++++++++ {core/database => database}/database.cpp | 0 {core/database => database}/database.h | 0 {core/database => database}/database_manager.cpp | 0 {core/database => database}/database_manager.h | 0 {core/database => database}/query_builder.cpp | 0 {core/database => database}/query_builder.h | 0 {core/database => database}/query_result.cpp | 0 {core/database => database}/query_result.h | 0 {core/database => database}/table_builder.cpp | 0 {core/database => database}/table_builder.h | 0 database_modules/mysql/mysql_database.cpp | 2 +- database_modules/mysql/mysql_database.h | 2 +- database_modules/mysql/mysql_query_builder.h | 2 +- database_modules/mysql/mysql_query_result.h | 2 +- database_modules/mysql/mysql_table_builder.h | 2 +- database_modules/postgres/pgsql_database.cpp | 2 +- database_modules/postgres/pgsql_database.h | 2 +- database_modules/sqlite/sqlite3_database.cpp | 2 +- database_modules/sqlite/sqlite3_database.h | 2 +- database_modules/sqlite/sqlite3_query_builder.h | 2 +- database_modules/sqlite/sqlite3_query_result.h | 2 +- database_modules/sqlite/sqlite3_table_builder.cpp | 2 +- database_modules/sqlite/sqlite3_table_builder.h | 2 +- web/http/session_manager.cpp | 8 ++++---- web/http/web_node.cpp | 10 +++++----- web_modules/folder_pages/static_folder_page.cpp | 2 +- web_modules/message_page/message_page.cpp | 8 ++++---- web_modules/rbac/rbac_controller.cpp | 10 +++++----- web_modules/users/user.cpp | 8 ++++---- web_modules/users/user_controller.cpp | 10 +++++----- 34 files changed, 62 insertions(+), 51 deletions(-) create mode 100644 database/SCsub rename {core/database => database}/database.cpp (100%) rename {core/database => database}/database.h (100%) rename {core/database => database}/database_manager.cpp (100%) rename {core/database => database}/database_manager.h (100%) rename {core/database => database}/query_builder.cpp (100%) rename {core/database => database}/query_builder.h (100%) rename {core/database => database}/query_result.cpp (100%) rename {core/database => database}/query_result.h (100%) rename {core/database => database}/table_builder.cpp (100%) rename {core/database => database}/table_builder.h (100%) diff --git a/SConstruct b/SConstruct index 5df2760..cb7da65 100644 --- a/SConstruct +++ b/SConstruct @@ -207,7 +207,7 @@ database_list = [] if env_base["databases"]: env_base.Append(CPPDEFINES=["DATABASES_ENABLED"]) - for x in sorted(glob.glob("database/*")): + for x in sorted(glob.glob("database_modules/*")): if not os.path.isdir(x) or not os.path.exists(x + "/detect.py"): continue tmppath = "./" + x @@ -216,8 +216,8 @@ if env_base["databases"]: import detect if detect.is_active() and detect.can_build(): - x = x.replace("database/", "") # rest of world - x = x.replace("database\\", "") # win32 + x = x.replace("database_modules/", "") # rest of world + x = x.replace("database_modules\\", "") # win32 database_list += [x] sys.path.remove(tmppath) @@ -278,7 +278,7 @@ SConscript("web/SCsub") SConscript("platform/SCsub") if env_base["databases"]: - #add db folder + SConscript("database/SCsub") for d in database_list: tmppath = "./database_modules/" + d diff --git a/core/object.cpp b/core/object.cpp index e190925..e164e9f 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1,6 +1,6 @@ #include "object.h" -#include "core/database/database.h" +#include "database/database.h" Object::Object() { db = nullptr; diff --git a/core/settings/db_settings.cpp b/core/settings/db_settings.cpp index be6f9de..fe736ac 100644 --- a/core/settings/db_settings.cpp +++ b/core/settings/db_settings.cpp @@ -1,10 +1,10 @@ #include "db_settings.h" -#include "core/database/database.h" -#include "core/database/database_manager.h" -#include "core/database/query_builder.h" -#include "core/database/query_result.h" -#include "core/database/table_builder.h" +#include "database/database.h" +#include "database/database_manager.h" +#include "database/query_builder.h" +#include "database/query_result.h" +#include "database/table_builder.h" void DBSettings::set_value(const String &key, const Variant &value) { const Variant &v = _data[key]; diff --git a/database/SCsub b/database/SCsub new file mode 100644 index 0000000..de4f8ef --- /dev/null +++ b/database/SCsub @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +Import("env") + +env.core_sources = [] + +env.add_source_files(env.core_sources, "*.cpp") + +# Build it all as a library +lib = env.add_library("database", env.core_sources) +env.Prepend(LIBS=[lib]) diff --git a/core/database/database.cpp b/database/database.cpp similarity index 100% rename from core/database/database.cpp rename to database/database.cpp diff --git a/core/database/database.h b/database/database.h similarity index 100% rename from core/database/database.h rename to database/database.h diff --git a/core/database/database_manager.cpp b/database/database_manager.cpp similarity index 100% rename from core/database/database_manager.cpp rename to database/database_manager.cpp diff --git a/core/database/database_manager.h b/database/database_manager.h similarity index 100% rename from core/database/database_manager.h rename to database/database_manager.h diff --git a/core/database/query_builder.cpp b/database/query_builder.cpp similarity index 100% rename from core/database/query_builder.cpp rename to database/query_builder.cpp diff --git a/core/database/query_builder.h b/database/query_builder.h similarity index 100% rename from core/database/query_builder.h rename to database/query_builder.h diff --git a/core/database/query_result.cpp b/database/query_result.cpp similarity index 100% rename from core/database/query_result.cpp rename to database/query_result.cpp diff --git a/core/database/query_result.h b/database/query_result.h similarity index 100% rename from core/database/query_result.h rename to database/query_result.h diff --git a/core/database/table_builder.cpp b/database/table_builder.cpp similarity index 100% rename from core/database/table_builder.cpp rename to database/table_builder.cpp diff --git a/core/database/table_builder.h b/database/table_builder.h similarity index 100% rename from core/database/table_builder.h rename to database/table_builder.h diff --git a/database_modules/mysql/mysql_database.cpp b/database_modules/mysql/mysql_database.cpp index f17be78..62b1505 100644 --- a/database_modules/mysql/mysql_database.cpp +++ b/database_modules/mysql/mysql_database.cpp @@ -2,7 +2,7 @@ #include -#include "core/database/database_manager.h" +#include "database/database_manager.h" #include "mysql_query_builder.h" #include "mysql_query_result.h" diff --git a/database_modules/mysql/mysql_database.h b/database_modules/mysql/mysql_database.h index 1ed12b7..e94d187 100644 --- a/database_modules/mysql/mysql_database.h +++ b/database_modules/mysql/mysql_database.h @@ -3,7 +3,7 @@ #include "core/string.h" -#include "core/database/database.h" +#include "database/database.h" #include diff --git a/database_modules/mysql/mysql_query_builder.h b/database_modules/mysql/mysql_query_builder.h index 38807fc..9bef10a 100644 --- a/database_modules/mysql/mysql_query_builder.h +++ b/database_modules/mysql/mysql_query_builder.h @@ -4,7 +4,7 @@ #include #include "core/string.h" -#include "core/database/query_builder.h" +#include "database/query_builder.h" class MysqlDatabase; class MysqlQueryResult; diff --git a/database_modules/mysql/mysql_query_result.h b/database_modules/mysql/mysql_query_result.h index 41b5249..6f61219 100644 --- a/database_modules/mysql/mysql_query_result.h +++ b/database_modules/mysql/mysql_query_result.h @@ -1,7 +1,7 @@ #ifndef MYSQL_QUERY_RESULT_H #define MYSQL_QUERY_RESULT_H -#include "core/database/query_result.h" +#include "database/query_result.h" #include diff --git a/database_modules/mysql/mysql_table_builder.h b/database_modules/mysql/mysql_table_builder.h index 4055e36..d836a8b 100644 --- a/database_modules/mysql/mysql_table_builder.h +++ b/database_modules/mysql/mysql_table_builder.h @@ -3,7 +3,7 @@ #include "core/string.h" -#include "core/database/table_builder.h" +#include "database/table_builder.h" class MysqlTableBuilder : public TableBuilder { RCPP_OBJECT(MysqlTableBuilder, TableBuilder); diff --git a/database_modules/postgres/pgsql_database.cpp b/database_modules/postgres/pgsql_database.cpp index 220c58c..49a1cd9 100644 --- a/database_modules/postgres/pgsql_database.cpp +++ b/database_modules/postgres/pgsql_database.cpp @@ -1,6 +1,6 @@ #include "pgsql_database.h" -#include "core/database/database_manager.h" +#include "database/database_manager.h" Database *PGSQLDatabase::_creation_func() { return new PGSQLDatabase(); diff --git a/database_modules/postgres/pgsql_database.h b/database_modules/postgres/pgsql_database.h index d05552a..d48e66c 100644 --- a/database_modules/postgres/pgsql_database.h +++ b/database_modules/postgres/pgsql_database.h @@ -1,7 +1,7 @@ #ifndef PGSQL_CONNECTION #define PGSQL_CONNECTION -#include "core/database/database.h" +#include "database/database.h" //Brynet has it aswell, and because of using namespace it is defined here aswell //later this will be fixed better diff --git a/database_modules/sqlite/sqlite3_database.cpp b/database_modules/sqlite/sqlite3_database.cpp index be9f432..abeb3ae 100644 --- a/database_modules/sqlite/sqlite3_database.cpp +++ b/database_modules/sqlite/sqlite3_database.cpp @@ -1,6 +1,6 @@ #include "sqlite3_database.h" -#include "core/database/database_manager.h" +#include "database/database_manager.h" #include "sqlite3_query_builder.h" #include "sqlite3_query_result.h" diff --git a/database_modules/sqlite/sqlite3_database.h b/database_modules/sqlite/sqlite3_database.h index 441b069..6771dc2 100644 --- a/database_modules/sqlite/sqlite3_database.h +++ b/database_modules/sqlite/sqlite3_database.h @@ -1,7 +1,7 @@ #ifndef SQLITE3_CONNECTION #define SQLITE3_CONNECTION -#include "core/database/database.h" +#include "database/database.h" //Brynet has it aswell, and because of using namespace it is defined here aswell //later this will be fixed better diff --git a/database_modules/sqlite/sqlite3_query_builder.h b/database_modules/sqlite/sqlite3_query_builder.h index 2c997d5..42925be 100644 --- a/database_modules/sqlite/sqlite3_query_builder.h +++ b/database_modules/sqlite/sqlite3_query_builder.h @@ -4,7 +4,7 @@ #include #include -#include "core/database/query_builder.h" +#include "database/query_builder.h" class SQLite3Database; diff --git a/database_modules/sqlite/sqlite3_query_result.h b/database_modules/sqlite/sqlite3_query_result.h index 7ae3138..ebe4c89 100644 --- a/database_modules/sqlite/sqlite3_query_result.h +++ b/database_modules/sqlite/sqlite3_query_result.h @@ -4,7 +4,7 @@ #include "core/string.h" #include -#include "core/database/query_result.h" +#include "database/query_result.h" #include "./sqlite/sqlite3.h" diff --git a/database_modules/sqlite/sqlite3_table_builder.cpp b/database_modules/sqlite/sqlite3_table_builder.cpp index b55ff19..2e0f53b 100644 --- a/database_modules/sqlite/sqlite3_table_builder.cpp +++ b/database_modules/sqlite/sqlite3_table_builder.cpp @@ -1,6 +1,6 @@ #include "sqlite3_table_builder.h" -#include "core/database/query_result.h" +#include "database/query_result.h" #include "sqlite3_database.h" diff --git a/database_modules/sqlite/sqlite3_table_builder.h b/database_modules/sqlite/sqlite3_table_builder.h index 0c2dfaa..421fe6d 100644 --- a/database_modules/sqlite/sqlite3_table_builder.h +++ b/database_modules/sqlite/sqlite3_table_builder.h @@ -3,7 +3,7 @@ #include "core/string.h" -#include "core/database/table_builder.h" +#include "database/table_builder.h" class SQLite3Database; diff --git a/web/http/session_manager.cpp b/web/http/session_manager.cpp index 968e400..a8a7654 100644 --- a/web/http/session_manager.cpp +++ b/web/http/session_manager.cpp @@ -4,10 +4,10 @@ #include #include -#include "core/database/database_manager.h" -#include "core/database/query_builder.h" -#include "core/database/query_result.h" -#include "core/database/table_builder.h" +#include "database/database_manager.h" +#include "database/query_builder.h" +#include "database/query_result.h" +#include "database/table_builder.h" #include "core/hash/sha256.h" diff --git a/web/http/web_node.cpp b/web/http/web_node.cpp index 5634589..88962fa 100644 --- a/web/http/web_node.cpp +++ b/web/http/web_node.cpp @@ -8,11 +8,11 @@ #include "core/settings/settings.h" #ifdef DATABASES_ENABLED -#include "core/database/database.h" -#include "core/database/database_manager.h" -#include "core/database/query_builder.h" -#include "core/database/query_result.h" -#include "core/database/table_builder.h" +#include "database/database.h" +#include "database/database_manager.h" +#include "database/query_builder.h" +#include "database/query_result.h" +#include "database/table_builder.h" #endif String WebNode::get_uri_segment() { diff --git a/web_modules/folder_pages/static_folder_page.cpp b/web_modules/folder_pages/static_folder_page.cpp index 89d70b3..1a3d825 100644 --- a/web_modules/folder_pages/static_folder_page.cpp +++ b/web_modules/folder_pages/static_folder_page.cpp @@ -4,7 +4,7 @@ #include #include "core/file_cache.h" -#include "core/database/database_manager.h" +#include "database/database_manager.h" #include "web/html/html_builder.h" void StaticFolderPage::handle_request_main(Request *request) { diff --git a/web_modules/message_page/message_page.cpp b/web_modules/message_page/message_page.cpp index f535d8f..a9bc005 100644 --- a/web_modules/message_page/message_page.cpp +++ b/web_modules/message_page/message_page.cpp @@ -1,10 +1,10 @@ #include "message_page.h" -#include "core/database/database.h" +#include "database/database.h" -#include "core/database/query_builder.h" -#include "core/database/table_builder.h" -#include "core/database/query_result.h" +#include "database/query_builder.h" +#include "database/table_builder.h" +#include "database/query_result.h" void MessagePage::handle_request_main(Request *request) { Ref b = db->get_query_builder(); diff --git a/web_modules/rbac/rbac_controller.cpp b/web_modules/rbac/rbac_controller.cpp index 57b2397..428cbd3 100644 --- a/web_modules/rbac/rbac_controller.cpp +++ b/web_modules/rbac/rbac_controller.cpp @@ -11,11 +11,11 @@ #include "rbac_default_permissions.h" #include "web_modules/users/user.h" -#include "core/database/database.h" -#include "core/database/database_manager.h" -#include "core/database/query_builder.h" -#include "core/database/query_result.h" -#include "core/database/table_builder.h" +#include "database/database.h" +#include "database/database_manager.h" +#include "database/query_builder.h" +#include "database/query_result.h" +#include "database/table_builder.h" void RBACController::handle_request_main(Request *request) { } diff --git a/web_modules/users/user.cpp b/web_modules/users/user.cpp index bf2d901..f6da8b5 100644 --- a/web_modules/users/user.cpp +++ b/web_modules/users/user.cpp @@ -8,10 +8,10 @@ #include #include -#include "core/database/database_manager.h" -#include "core/database/query_builder.h" -#include "core/database/query_result.h" -#include "core/database/table_builder.h" +#include "database/database_manager.h" +#include "database/query_builder.h" +#include "database/query_result.h" +#include "database/table_builder.h" #include "web/html/form_validator.h" #include "web/html/html_builder.h" diff --git a/web_modules/users/user_controller.cpp b/web_modules/users/user_controller.cpp index 76eb6ed..c88f088 100644 --- a/web_modules/users/user_controller.cpp +++ b/web_modules/users/user_controller.cpp @@ -7,11 +7,11 @@ #include "web/http/request.h" #include "web/http/session_manager.h" -#include "core/database/database.h" -#include "core/database/database_manager.h" -#include "core/database/query_builder.h" -#include "core/database/query_result.h" -#include "core/database/table_builder.h" +#include "database/database.h" +#include "database/database_manager.h" +#include "database/query_builder.h" +#include "database/query_result.h" +#include "database/table_builder.h" #include "core/hash/sha256.h"