DatabaseConnection::database_connect() now returns Error.

This commit is contained in:
Relintai 2024-04-27 14:41:42 +02:00
parent 06e0be8d04
commit add7fff92b
4 changed files with 8 additions and 4 deletions

View File

@ -36,7 +36,8 @@
#include "query_result.h"
#include "table_builder.h"
void DatabaseConnection::database_connect(const String &connection_str) {
Error DatabaseConnection::database_connect(const String &connection_str) {
return ERR_PRINTER_ON_FIRE;
}
Ref<QueryResult> DatabaseConnection::query(const String &query) {

View File

@ -45,7 +45,7 @@ class DatabaseConnection : public Reference {
GDCLASS(DatabaseConnection, Reference);
public:
virtual void database_connect(const String &connection_str);
virtual Error database_connect(const String &connection_str);
virtual Ref<QueryResult> query(const String &query);
virtual void query_run(const String &query);

View File

@ -26,7 +26,7 @@ Ref<TableBuilder> SQLite3DatabaseConnection::get_table_builder() {
return b;
}
void SQLite3DatabaseConnection::database_connect(const String &connection_str) {
Error SQLite3DatabaseConnection::database_connect(const String &connection_str) {
int ret = sqlite3_config(SQLITE_CONFIG_SERIALIZED);
//if (ret != SQLITE_OK) {
//ERR_PRINT("SQLITE3 multithreading is not supported!\n");
@ -39,7 +39,10 @@ void SQLite3DatabaseConnection::database_connect(const String &connection_str) {
if (ret != SQLITE_OK) {
ERR_PRINT(vformat("SQLITE3 database_connect failed! code: %d !", ret));
return FAILED;
}
return OK;
}
Ref<QueryResult> SQLite3DatabaseConnection::query(const String &query) {

View File

@ -13,7 +13,7 @@ struct sqlite3;
class SQLite3DatabaseConnection : public DatabaseConnection {
public:
void database_connect(const String &connection_str);
Error database_connect(const String &connection_str);
Ref<QueryResult> query(const String &query);
void query_run(const String &query);