mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-11-23 09:28:07 +01:00
Separated Database and DatabaseConnection into different files.
This commit is contained in:
parent
2ec4fe922f
commit
be6ec3ee61
@ -1,48 +1,10 @@
|
||||
#include "database.h"
|
||||
|
||||
#include "database_connection.h"
|
||||
#include "query_builder.h"
|
||||
#include "query_result.h"
|
||||
#include "table_builder.h"
|
||||
|
||||
void DatabaseConnection::connect(const String &connection_str) {
|
||||
}
|
||||
|
||||
Ref<QueryResult> DatabaseConnection::query(const String &query) {
|
||||
return Ref<QueryResult>();
|
||||
}
|
||||
void DatabaseConnection::query_run(const String &query) {
|
||||
}
|
||||
|
||||
Ref<QueryBuilder> DatabaseConnection::get_query_builder() {
|
||||
return Ref<QueryBuilder>(new QueryBuilder());
|
||||
}
|
||||
|
||||
Ref<TableBuilder> DatabaseConnection::get_table_builder() {
|
||||
return Ref<TableBuilder>(new TableBuilder());
|
||||
}
|
||||
|
||||
String DatabaseConnection::escape(const String &str) {
|
||||
return String();
|
||||
}
|
||||
|
||||
void DatabaseConnection::escape_to(const String &str, String *to) {
|
||||
}
|
||||
|
||||
DatabaseConnection::DatabaseConnection() {
|
||||
}
|
||||
|
||||
DatabaseConnection::~DatabaseConnection() {
|
||||
}
|
||||
|
||||
void DatabaseConnection::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("connect", "connection_str"), &DatabaseConnection::connect);
|
||||
ClassDB::bind_method(D_METHOD("query", "query"), &DatabaseConnection::query);
|
||||
ClassDB::bind_method(D_METHOD("query_run", "query"), &DatabaseConnection::query_run);
|
||||
ClassDB::bind_method(D_METHOD("get_query_builder"), &DatabaseConnection::get_query_builder);
|
||||
ClassDB::bind_method(D_METHOD("get_table_builder"), &DatabaseConnection::get_table_builder);
|
||||
ClassDB::bind_method(D_METHOD("escape", "str"), &DatabaseConnection::escape);
|
||||
}
|
||||
|
||||
String Database::get_connection_string() {
|
||||
return _connection_string;
|
||||
}
|
||||
|
@ -8,27 +8,7 @@
|
||||
class QueryBuilder;
|
||||
class TableBuilder;
|
||||
class QueryResult;
|
||||
|
||||
class DatabaseConnection : public Reference {
|
||||
GDCLASS(DatabaseConnection, Reference);
|
||||
|
||||
public:
|
||||
virtual void connect(const String &connection_str);
|
||||
virtual Ref<QueryResult> query(const String &query);
|
||||
virtual void query_run(const String &query);
|
||||
|
||||
virtual Ref<QueryBuilder> get_query_builder();
|
||||
virtual Ref<TableBuilder> get_table_builder();
|
||||
|
||||
virtual String escape(const String &str);
|
||||
virtual void escape_to(const String &str, String *to);
|
||||
|
||||
DatabaseConnection();
|
||||
~DatabaseConnection();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
};
|
||||
class DatabaseConnection;
|
||||
|
||||
class Database : public Reference {
|
||||
GDCLASS(Database, Reference);
|
||||
|
45
modules/database/database_connection.cpp
Normal file
45
modules/database/database_connection.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
#include "database_connection.h"
|
||||
|
||||
#include "database.h"
|
||||
#include "query_builder.h"
|
||||
#include "query_result.h"
|
||||
#include "table_builder.h"
|
||||
|
||||
void DatabaseConnection::connect(const String &connection_str) {
|
||||
}
|
||||
|
||||
Ref<QueryResult> DatabaseConnection::query(const String &query) {
|
||||
return Ref<QueryResult>();
|
||||
}
|
||||
void DatabaseConnection::query_run(const String &query) {
|
||||
}
|
||||
|
||||
Ref<QueryBuilder> DatabaseConnection::get_query_builder() {
|
||||
return Ref<QueryBuilder>(new QueryBuilder());
|
||||
}
|
||||
|
||||
Ref<TableBuilder> DatabaseConnection::get_table_builder() {
|
||||
return Ref<TableBuilder>(new TableBuilder());
|
||||
}
|
||||
|
||||
String DatabaseConnection::escape(const String &str) {
|
||||
return String();
|
||||
}
|
||||
|
||||
void DatabaseConnection::escape_to(const String &str, String *to) {
|
||||
}
|
||||
|
||||
DatabaseConnection::DatabaseConnection() {
|
||||
}
|
||||
|
||||
DatabaseConnection::~DatabaseConnection() {
|
||||
}
|
||||
|
||||
void DatabaseConnection::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("connect", "connection_str"), &DatabaseConnection::connect);
|
||||
ClassDB::bind_method(D_METHOD("query", "query"), &DatabaseConnection::query);
|
||||
ClassDB::bind_method(D_METHOD("query_run", "query"), &DatabaseConnection::query_run);
|
||||
ClassDB::bind_method(D_METHOD("get_query_builder"), &DatabaseConnection::get_query_builder);
|
||||
ClassDB::bind_method(D_METHOD("get_table_builder"), &DatabaseConnection::get_table_builder);
|
||||
ClassDB::bind_method(D_METHOD("escape", "str"), &DatabaseConnection::escape);
|
||||
}
|
33
modules/database/database_connection.h
Normal file
33
modules/database/database_connection.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef DATABASE_CONNECTION_H
|
||||
#define DATABASE_CONNECTION_H
|
||||
|
||||
#include "core/ustring.h"
|
||||
|
||||
#include "core/reference.h"
|
||||
|
||||
class QueryBuilder;
|
||||
class TableBuilder;
|
||||
class QueryResult;
|
||||
|
||||
class DatabaseConnection : public Reference {
|
||||
GDCLASS(DatabaseConnection, Reference);
|
||||
|
||||
public:
|
||||
virtual void connect(const String &connection_str);
|
||||
virtual Ref<QueryResult> query(const String &query);
|
||||
virtual void query_run(const String &query);
|
||||
|
||||
virtual Ref<QueryBuilder> get_query_builder();
|
||||
virtual Ref<TableBuilder> get_table_builder();
|
||||
|
||||
virtual String escape(const String &str);
|
||||
virtual void escape_to(const String &str, String *to);
|
||||
|
||||
DatabaseConnection();
|
||||
~DatabaseConnection();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user