@@ -39,20 +39,24 @@ with this program; if not, write to the Free Software Foundation, Inc.,
39
39
#include " remoteplayer.h"
40
40
#include " server/player_sao.h"
41
41
42
- Database_PostgreSQL::Database_PostgreSQL (const std::string &connect_string) :
42
+ Database_PostgreSQL::Database_PostgreSQL (const std::string &connect_string,
43
+ const char *type) :
43
44
m_connect_string(connect_string)
44
45
{
45
46
if (m_connect_string.empty ()) {
46
- throw SettingNotFoundException (
47
- " Set pgsql_connection string in world.mt to "
47
+ // Use given type to reference the exact setting in the error message
48
+ std::string s = type;
49
+ std::string msg =
50
+ " Set pgsql" + s + " _connection string in world.mt to "
48
51
" use the postgresql backend\n "
49
52
" Notes:\n "
50
- " pgsql_connection has the following form: \n "
51
- " \t pgsql_connection = host=127.0.0.1 port=5432 user=mt_user "
52
- " password=mt_password dbname=minetest_world \n "
53
+ " pgsql " + s + " _connection has the following form: \n "
54
+ " \t pgsql " + s + " _connection = host=127.0.0.1 port=5432 "
55
+ " user=mt_user password=mt_password dbname=minetest " + s + " \n "
53
56
" mt_user should have CREATE TABLE, INSERT, SELECT, UPDATE and "
54
- " DELETE rights on the database.\n "
55
- " Don't create mt_user as a SUPERUSER!" );
57
+ " DELETE rights on the database. "
58
+ " Don't create mt_user as a SUPERUSER!" ;
59
+ throw SettingNotFoundException (msg);
56
60
}
57
61
}
58
62
@@ -166,7 +170,7 @@ void Database_PostgreSQL::rollback()
166
170
}
167
171
168
172
MapDatabasePostgreSQL::MapDatabasePostgreSQL (const std::string &connect_string):
169
- Database_PostgreSQL(connect_string),
173
+ Database_PostgreSQL(connect_string, " " ),
170
174
MapDatabase()
171
175
{
172
176
connectToDatabase ();
@@ -315,7 +319,7 @@ void MapDatabasePostgreSQL::listAllLoadableBlocks(std::vector<v3s16> &dst)
315
319
* Player Database
316
320
*/
317
321
PlayerDatabasePostgreSQL::PlayerDatabasePostgreSQL (const std::string &connect_string):
318
- Database_PostgreSQL(connect_string),
322
+ Database_PostgreSQL(connect_string, " _player " ),
319
323
PlayerDatabase()
320
324
{
321
325
connectToDatabase ();
@@ -637,7 +641,8 @@ void PlayerDatabasePostgreSQL::listPlayers(std::vector<std::string> &res)
637
641
}
638
642
639
643
AuthDatabasePostgreSQL::AuthDatabasePostgreSQL (const std::string &connect_string) :
640
- Database_PostgreSQL(connect_string), AuthDatabase()
644
+ Database_PostgreSQL(connect_string, " _auth" ),
645
+ AuthDatabase()
641
646
{
642
647
connectToDatabase ();
643
648
}
0 commit comments