@@ -39,20 +39,24 @@ with this program; if not, write to the Free Software Foundation, Inc.,
3939#include " remoteplayer.h"
4040#include " server/player_sao.h"
4141
42- Database_PostgreSQL::Database_PostgreSQL (const std::string &connect_string) :
42+ Database_PostgreSQL::Database_PostgreSQL (const std::string &connect_string,
43+ const char *type) :
4344 m_connect_string(connect_string)
4445{
4546 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 "
4851 " use the postgresql backend\n "
4952 " 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 "
5356 " 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);
5660 }
5761}
5862
@@ -166,7 +170,7 @@ void Database_PostgreSQL::rollback()
166170}
167171
168172MapDatabasePostgreSQL::MapDatabasePostgreSQL (const std::string &connect_string):
169- Database_PostgreSQL(connect_string),
173+ Database_PostgreSQL(connect_string, " " ),
170174 MapDatabase()
171175{
172176 connectToDatabase ();
@@ -315,7 +319,7 @@ void MapDatabasePostgreSQL::listAllLoadableBlocks(std::vector<v3s16> &dst)
315319 * Player Database
316320 */
317321PlayerDatabasePostgreSQL::PlayerDatabasePostgreSQL (const std::string &connect_string):
318- Database_PostgreSQL(connect_string),
322+ Database_PostgreSQL(connect_string, " _player " ),
319323 PlayerDatabase()
320324{
321325 connectToDatabase ();
@@ -637,7 +641,8 @@ void PlayerDatabasePostgreSQL::listPlayers(std::vector<std::string> &res)
637641}
638642
639643AuthDatabasePostgreSQL::AuthDatabasePostgreSQL (const std::string &connect_string) :
640- Database_PostgreSQL(connect_string), AuthDatabase()
644+ Database_PostgreSQL(connect_string, " _auth" ),
645+ AuthDatabase()
641646{
642647 connectToDatabase ();
643648}
0 commit comments