summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-04-23 14:35:08 +0200
committerGitHub <noreply@github.com>2017-04-23 14:35:08 +0200
commit29ab20c27229672c24a7699afbcd54caad903331 (patch)
treee42e7ea35f54b1439055abc500191eb29baa6355 /src/map.cpp
parentdda171d2925e20efc00c78bcb45cf595fd986da9 (diff)
downloadminetest-29ab20c27229672c24a7699afbcd54caad903331.tar.gz
minetest-29ab20c27229672c24a7699afbcd54caad903331.tar.bz2
minetest-29ab20c27229672c24a7699afbcd54caad903331.zip
Player data to Database (#5475)
* Player data to Database Add player data into databases (SQLite3 & PG only) PostgreSQL & SQLite: better POO Design for databases Add --migrate-players argument to server + deprecation warning * Remove players directory if empty
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 75dcee350..c148c51f1 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -2286,13 +2286,13 @@ bool ServerMap::loadSectorFull(v2s16 p2d)
}
#endif
-Database *ServerMap::createDatabase(
+MapDatabase *ServerMap::createDatabase(
const std::string &name,
const std::string &savedir,
Settings &conf)
{
if (name == "sqlite3")
- return new Database_SQLite3(savedir);
+ return new MapDatabaseSQLite3(savedir);
if (name == "dummy")
return new Database_Dummy();
#if USE_LEVELDB
@@ -2304,8 +2304,11 @@ Database *ServerMap::createDatabase(
return new Database_Redis(conf);
#endif
#if USE_POSTGRESQL
- else if (name == "postgresql")
- return new Database_PostgreSQL(conf);
+ else if (name == "postgresql") {
+ std::string connect_string = "";
+ conf.getNoEx("pgsql_connection", connect_string);
+ return new MapDatabasePostgreSQL(connect_string);
+ }
#endif
else
throw BaseException(std::string("Database backend ") + name + " not supported.");
@@ -2326,7 +2329,7 @@ bool ServerMap::saveBlock(MapBlock *block)
return saveBlock(block, dbase);
}
-bool ServerMap::saveBlock(MapBlock *block, Database *db)
+bool ServerMap::saveBlock(MapBlock *block, MapDatabase *db)
{
v3s16 p3d = block->getPos();