2022-07-06 10:11:17 +02:00
|
|
|
#include "database_single_threaded.h"
|
|
|
|
|
|
|
|
#include "database_connection.h"
|
|
|
|
#include "query_builder.h"
|
|
|
|
#include "query_result.h"
|
|
|
|
#include "table_builder.h"
|
|
|
|
|
|
|
|
Ref<DatabaseConnection> DatabaseSingleThreaded::get_connection() {
|
|
|
|
if (!_connection.is_valid()) {
|
|
|
|
_connection = _allocate_connection();
|
|
|
|
}
|
|
|
|
|
|
|
|
return _connection;
|
|
|
|
}
|
|
|
|
|
|
|
|
Ref<DatabaseConnection> DatabaseSingleThreaded::_allocate_connection() {
|
|
|
|
Ref<DatabaseConnection> dbc;
|
|
|
|
dbc.instance();
|
|
|
|
dbc->set_owner(this);
|
2022-07-06 12:53:54 +02:00
|
|
|
dbc->database_connect(_connection_string);
|
2022-07-06 10:11:17 +02:00
|
|
|
return dbc;
|
|
|
|
}
|
|
|
|
|
|
|
|
DatabaseSingleThreaded::DatabaseSingleThreaded() {
|
|
|
|
}
|
|
|
|
|
|
|
|
DatabaseSingleThreaded::~DatabaseSingleThreaded() {
|
|
|
|
if (_connection.is_valid()) {
|
|
|
|
_connection->set_owner(nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
_connection.unref();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DatabaseSingleThreaded::_bind_methods() {
|
|
|
|
}
|