diff --git a/modules/database/database.cpp b/modules/database/database.cpp index 41e4691ad..b55ead41a 100644 --- a/modules/database/database.cpp +++ b/modules/database/database.cpp @@ -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 DatabaseConnection::query(const String &query) { - return Ref(); -} -void DatabaseConnection::query_run(const String &query) { -} - -Ref DatabaseConnection::get_query_builder() { - return Ref(new QueryBuilder()); -} - -Ref DatabaseConnection::get_table_builder() { - return Ref(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; } diff --git a/modules/database/database.h b/modules/database/database.h index 3e4333888..b439a957f 100644 --- a/modules/database/database.h +++ b/modules/database/database.h @@ -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 query(const String &query); - virtual void query_run(const String &query); - - virtual Ref get_query_builder(); - virtual Ref 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); diff --git a/modules/database/database_connection.cpp b/modules/database/database_connection.cpp new file mode 100644 index 000000000..bc9d0ce2a --- /dev/null +++ b/modules/database/database_connection.cpp @@ -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 DatabaseConnection::query(const String &query) { + return Ref(); +} +void DatabaseConnection::query_run(const String &query) { +} + +Ref DatabaseConnection::get_query_builder() { + return Ref(new QueryBuilder()); +} + +Ref DatabaseConnection::get_table_builder() { + return Ref(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); +} diff --git a/modules/database/database_connection.h b/modules/database/database_connection.h new file mode 100644 index 000000000..80e247496 --- /dev/null +++ b/modules/database/database_connection.h @@ -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 query(const String &query); + virtual void query_run(const String &query); + + virtual Ref get_query_builder(); + virtual Ref 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