2022-06-30 13:23:48 +02:00
|
|
|
#include "database.h"
|
|
|
|
|
2022-07-06 09:33:57 +02:00
|
|
|
#include "database_connection.h"
|
2022-06-30 13:23:48 +02:00
|
|
|
#include "query_builder.h"
|
|
|
|
#include "query_result.h"
|
2022-07-06 09:17:49 +02:00
|
|
|
#include "table_builder.h"
|
2022-06-30 13:23:48 +02:00
|
|
|
|
2022-07-06 09:30:50 +02:00
|
|
|
String Database::get_connection_string() {
|
|
|
|
return _connection_string;
|
|
|
|
}
|
|
|
|
void Database::set_connection_string(const String &val) {
|
|
|
|
_connection_string = val;
|
|
|
|
}
|
|
|
|
|
|
|
|
Ref<DatabaseConnection> Database::get_connection() {
|
|
|
|
return _allocate_connection();
|
|
|
|
}
|
|
|
|
|
|
|
|
Ref<DatabaseConnection> Database::_allocate_connection() {
|
2022-07-06 09:44:02 +02:00
|
|
|
//Ref<DatabaseConnection> dbc;
|
|
|
|
//dbc.instance();
|
|
|
|
//dbc->set_owner(this); //if needed
|
2022-07-06 10:11:17 +02:00
|
|
|
//dbc->connect(_connection_string);
|
2022-07-06 09:44:02 +02:00
|
|
|
//return dbc;
|
|
|
|
|
2022-07-06 09:30:50 +02:00
|
|
|
return Ref<DatabaseConnection>();
|
2022-06-30 13:23:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Database::Database() {
|
|
|
|
}
|
|
|
|
|
|
|
|
Database::~Database() {
|
2022-07-06 09:17:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Database::_bind_methods() {
|
2022-07-06 09:30:50 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_connection_string"), &Database::get_connection_string);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_connection_string", "value"), &Database::set_connection_string);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::STRING, "connection_string"), "set_connection_string", "get_connection_string");
|
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("get_connection"), &Database::get_connection);
|
2022-07-06 09:17:49 +02:00
|
|
|
}
|