Added the database classes to the build.

This commit is contained in:
Relintai 2022-07-06 12:46:22 +02:00
parent 6389a5714d
commit 66587299a8
8 changed files with 46 additions and 11 deletions

View File

@ -7,6 +7,15 @@ module_env = env.Clone()
sources = [
"register_types.cpp",
"database.cpp",
"database_connection.cpp",
"database_manager.cpp",
"database_multi_threaded.cpp",
"database_single_threaded.cpp",
"query_builder.cpp",
"query_result.cpp",
"table_builder.cpp",
]
if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes':

View File

@ -10,6 +10,14 @@ def configure(env):
def get_doc_classes():
return [
#"",
"Database",
"DatabaseConnection",
"DatabaseManager",
"DatabaseMultiThreaded",
"DatabaseSingleThreaded",
"QueryBuilder",
"QueryResult",
"TableBuilder",
]
def get_doc_path():

View File

@ -33,6 +33,10 @@ Ref<Database> DatabaseConnection::get_owner() {
return Ref<Database>(_owner);
}
void DatabaseConnection::set_owner(Database *owner) {
_owner = owner;
}
DatabaseConnection::DatabaseConnection() {
_owner = nullptr;
}

View File

@ -1,11 +1,12 @@
#include "database_manager.h"
#include "database.h"
void DatabaseManager::load() {
//go thourgh settings, and create all the defined db backends
//add them to ProjectSettings
//add them to ProjectSettings
}
DatabaseManager *DatabaseManager::get_singleton() {
return _instance;
}
@ -19,4 +20,3 @@ DatabaseManager::~DatabaseManager() {
}
DatabaseManager *DatabaseManager::_instance = nullptr;

View File

@ -373,7 +373,7 @@ void QueryBuilder::_bind_methods() {
ClassDB::bind_method(D_METHOD("select_last_insert_id"), &QueryBuilder::_select_last_insert_id_bind);
ClassDB::bind_method(D_METHOD("escape", "param"), &QueryBuilder::_escape_bind);
ClassDB::bind_method(D_METHOD("escape", "param"), &QueryBuilder::escape);
ClassDB::bind_method(D_METHOD("prepare"), &QueryBuilder::_prepare_bind);
ClassDB::bind_method(D_METHOD("set_params", "index", "value"), &QueryBuilder::_set_params_bind);
@ -575,10 +575,6 @@ Ref<QueryBuilder> QueryBuilder::_select_last_insert_id_bind() {
return Ref<QueryBuilder>(select_last_insert_id());
}
Ref<String> QueryBuilder::_escape_bind(const String &params) {
return Ref<QueryBuilder>(escape(params));
}
Ref<QueryBuilder> QueryBuilder::_prepare_bind() {
return Ref<QueryBuilder>(prepare());
}

View File

@ -203,8 +203,6 @@ protected:
Ref<QueryBuilder> _select_last_insert_id_bind();
Ref<String> _escape_bind(const String &params);
Ref<QueryBuilder> _prepare_bind();
Ref<QueryBuilder> _set_params_bind(const int index, const String &value);
Ref<QueryBuilder> _set_parami_bind(const int index, const int value);

View File

@ -22,8 +22,24 @@ SOFTWARE.
#include "register_types.h"
#include "database.h"
#include "database_connection.h"
#include "database_manager.h"
#include "database_multi_threaded.h"
#include "database_single_threaded.h"
#include "query_builder.h"
#include "query_result.h"
#include "table_builder.h"
void register_database_types() {
//ClassDB::register_class<>();
ClassDB::register_class<Database>();
ClassDB::register_class<DatabaseConnection>();
ClassDB::register_class<DatabaseManager>();
ClassDB::register_class<DatabaseMultiThreaded>();
ClassDB::register_class<DatabaseSingleThreaded>();
ClassDB::register_class<QueryBuilder>();
ClassDB::register_class<QueryResult>();
ClassDB::register_class<TableBuilder>();
}
void unregister_database_types() {

View File

@ -34,6 +34,10 @@ TableBuilder *TableBuilder::real_double(const String &name, const int size, cons
return this;
}
TableBuilder *TableBuilder::date(const String &name) {
return this;
}
TableBuilder *TableBuilder::varchar(const String &name, const int length) {
return this;
}