Browse Source

An neue Datenbank angepasst

Kolja Strohm 7 years ago
parent
commit
3960186316

+ 44 - 172
InformationServer/Datenbank.cpp

@@ -7,21 +7,28 @@
 // Konstruktor
 ISDatenbank::ISDatenbank( InitDatei *zIni )
 {
-	if( !zIni->wertExistiert( "DBBenutzer" ) )
-		zIni->addWert( "DBBenutzer", "informationserveru" );
-	if( !zIni->wertExistiert( "DBPasswort" ) )
-		zIni->addWert( "DBPasswort", "LTInformationServerPW" );
-	if( !zIni->wertExistiert( "DBName" ) )
-		zIni->addWert( "DBName", "lenck_tech_db" );
-	if( !zIni->wertExistiert( "DBIP" ) )
-		zIni->addWert( "DBIP", "127.0.0.1" );
-	if( !zIni->wertExistiert( "DBPort" ) )
-		zIni->addWert( "DBPort", "5432" );
 	datenbank = new Datenbank( zIni->zWert( "DBBenutzer" )->getText(), zIni->zWert( "DBPasswort" )->getText(),
 							   zIni->zWert( "DBName" )->getText(), zIni->zWert( "DBIP" )->getText(),
 							   (unsigned short)TextZuInt( zIni->zWert( "DBPort" )->getText(), 10 ) );
+    if( !datenbank->istOk() )
+    {
+        std::cout << "IS: Die Verbindung zur Datenbank konnte nicht hergestellt werden.\nDas Programm wird beendet.";
+        exit( 1 );
+    }
 	InitializeCriticalSection( &cs );
 	ref = 1;
+    Text befehl = "SELECT port, admin_port  FROM server WHERE id = ";
+    befehl += zIni->zWert( "ServerId" )->getText();
+    lock();
+    datenbank->befehl( befehl );
+    Result res = datenbank->getResult();
+    unlock();
+    if( res.zeilenAnzahl == 1 )
+    {
+        zIni->addWert( "ServerPort", res.values[ 0 ] );
+        zIni->addWert( "AdminServerPort", res.values[ 1 ] );
+    }
+    res.destroy();
 }
 
 // Destruktor
@@ -46,9 +53,9 @@ int ISDatenbank::istAdministrator( const char *name, const char *passwort )
 {
 	Text *befehl = new Text( "SELECT id FROM benutzer WHERE name = '" );
 	befehl->append( name );
-	befehl->append( "' AND passwort = '" );
+	befehl->append( "' AND passwort = md5('" );
 	befehl->append( passwort );
-	befehl->append( "'" );
+	befehl->append( "')" );
 	lock();
 	datenbank->befehl( befehl->getText() );
 	Result res = datenbank->getResult();
@@ -77,7 +84,7 @@ bool ISDatenbank::adminHatRecht( int id, int recht )
 
 bool ISDatenbank::proveKlient( int num, int sNum )
 {
-	Text *befehl = new Text( "SELECT * FROM server_information_clients WHERE server_information_id = " );
+	Text *befehl = new Text( "SELECT * FROM server_client WHERE server_id = " );
 	befehl->append( sNum );
 	befehl->append( " AND client_id = " );
 	befehl->append( num );
@@ -96,7 +103,7 @@ bool ISDatenbank::proveKlient( int num, int sNum )
 Text *ISDatenbank::getKlientKey( int cId )
 {
 	lock();
-	if( !datenbank->befehl( Text( "SELECT schluessel FROM clients WHERE id = " ) += cId ) )
+	if( !datenbank->befehl( Text( "SELECT schluessel FROM client WHERE id = " ) += cId ) )
 	{
 		unlock();
 		return 0;
@@ -115,9 +122,9 @@ Text *ISDatenbank::getKlientKey( int cId )
 
 void ISDatenbank::unregisterKlient( int num, int sNum )
 {
-	Text *befehl = new Text( "DELETE FROM server_information_clients WHERE client_id = " );
+	Text *befehl = new Text( "DELETE FROM server_client WHERE client_id = " );
 	befehl->append( num );
-	befehl->append( " AND server_information_id = " );
+	befehl->append( " AND server_id = " );
 	befehl->append( sNum );
 	lock();
 	datenbank->befehl( befehl->getText() );
@@ -125,7 +132,7 @@ void ISDatenbank::unregisterKlient( int num, int sNum )
 	unlock();
 	if( za == 1 )
 	{
-		befehl->setText( "UPDATE server_information SET clients = clients - 1 WHERE id = " );
+		befehl->setText( "UPDATE server SET tasks = tasks - 1 WHERE id = " );
 		befehl->append( sNum );
 		lock();
 		datenbank->befehl( befehl->getText() );
@@ -134,114 +141,9 @@ void ISDatenbank::unregisterKlient( int num, int sNum )
 	befehl->release();
 }
 
-bool ISDatenbank::serverAnmelden( InitDatei *zIni )
-{
-	if( !zIni->wertExistiert( "ServerId" ) )
-		zIni->addWert( "ServerId", "0" );
-	if( !zIni->wertExistiert( "ServerName" ) )
-		zIni->addWert( "ServerName", "Name" );
-	if( !zIni->wertExistiert( "ServerPort" ) )
-		zIni->addWert( "ServerPort", "49144" );
-	if( !zIni->wertExistiert( "ServerIP" ) )
-		zIni->addWert( "ServerIP", "127.0.0.1" );
-	if( !zIni->wertExistiert( "AdminServerPort" ) )
-		zIni->addWert( "AdminServerPort", "49143" );
-	if( !zIni->wertExistiert( "Aktiv" ) )
-		zIni->addWert( "Aktiv", "FALSE" );
-	if( !zIni->wertExistiert( "MaxClients" ) )
-		zIni->addWert( "MaxClients", "50" );
-	bool insert = 0;
-	int id = *zIni->zWert( "ServerId" );
-	if( id )
-	{
-		lock();
-		if( !datenbank->befehl( Text( "SELECT id FROM server_information WHERE id = " ) += id ) )
-		{
-			unlock();
-			return 0;
-		}
-		int anz = datenbank->getZeilenAnzahl();
-		unlock();
-		insert = anz == 0;
-		if( !insert )
-		{
-			lock();
-			if( !datenbank->befehl( Text( "SELECT id FROM server_information WHERE server_status_id = 1 AND id = " ) += id ) )
-			{
-				unlock();
-				return 0;
-			}
-			int anz = datenbank->getZeilenAnzahl();
-			unlock();
-			if( !anz ) // Server läuft bereits
-				return 0;
-		}
-	}
-	if( insert || !id )
-	{ // Neuer Eintrag in Tabelle server_information
-		Text *befehl = new Text( "INSERT INTO server_information( " );
-		if( id )
-			*befehl += "id, ";
-		*befehl += "name, ip, port, admin_port, server_status_id, max_clients ) VALUES( ";
-		if( id )
-		{
-			*befehl += id;
-			*befehl += ", ";
-		}
-		*befehl += "'";
-		*befehl += zIni->zWert( "ServerName" )->getText();
-		*befehl += "', '";
-		*befehl += zIni->zWert( "ServerIP" )->getText();
-		*befehl += "', ";
-		*befehl += zIni->zWert( "ServerPort" )->getText();
-		*befehl += ", ";
-		*befehl += zIni->zWert( "AdminServerPort" )->getText();
-		*befehl += ", 1, ";
-		*befehl += zIni->zWert( "MaxClients" )->getText();
-		*befehl += " ) RETURNING id";
-		lock();
-		if( !datenbank->befehl( *befehl ) )
-		{
-			unlock();
-			befehl->release();
-			return 0;
-		}
-		Result res = datenbank->getResult();
-		unlock();
-		befehl->release();
-		if( !res.zeilenAnzahl )
-		{
-			res.destroy();
-			return 0;
-		}
-		zIni->setWert( "ServerId", res.values[ 0 ] );
-		return 1;
-	}
-	else
-	{ // Alten Eintrag aus Tabelle server_information ändern
-		Text *befehl = new Text( "UPDATE server_information SET name = '" );
-		*befehl += zIni->zWert( "ServerName" )->getText();
-		*befehl += "', port = ";
-		*befehl += zIni->zWert( "ServerPort" )->getText();
-		*befehl += ", ip = '";
-		*befehl += zIni->zWert( "ServerIP" )->getText();
-		*befehl += "', max_clients = ";
-		*befehl += zIni->zWert( "MaxClients" )->getText();
-		*befehl += ", admin_port = ";
-		*befehl += zIni->zWert( "AdminServerPort" )->getText();
-		*befehl += " WHERE id = ";
-		*befehl += id;
-		lock();
-		bool ret = datenbank->befehl( *befehl );
-		unlock();
-		befehl->release();
-		return ret;
-	}
-}
-
 bool ISDatenbank::setServerStatus( int id, int status )
 {
-	Text *befehl = new Text( "UPDATE server_information SET server_status_id = " );
+	Text *befehl = new Text( "UPDATE server SET server_status_id = " );
 	*befehl += status;
 	*befehl += "WHERE id = ";
 	*befehl += id;
@@ -260,7 +162,7 @@ bool ISDatenbank::setServerStatus( int id, int status )
 
 bool ISDatenbank::setMaxClients( int id, int maxC )
 {
-	Text *befehl = new Text( "UPDATE server_information SET max_clients = " );
+	Text *befehl = new Text( "UPDATE server SET max_tasks = " );
 	befehl->append( maxC );
 	befehl->append( " WHERE id = " );
 	befehl->append( id );
@@ -277,33 +179,9 @@ bool ISDatenbank::setMaxClients( int id, int maxC )
 	return ret;
 }
 
-int ISDatenbank::getAdminPort( int id )
-{
-	Text *befehl = new Text( "SELECT admin_port FROM server_information WHERE id = " );
-	befehl->append( id );
-	lock();
-	if( !datenbank->befehl( befehl->getText() ) )
-	{
-		unlock();
-		befehl->release();
-		return 0;
-	}
-	Result res = datenbank->getResult();
-	unlock();
-	befehl->release();
-	if( !res.zeilenAnzahl )
-	{
-		res.destroy();
-		return 0;
-	}
-	int ret = TextZuInt( res.values[ 0 ].getText(), 10 );
-	res.destroy();
-	return ret;
-}
-
 bool ISDatenbank::serverIstNichtPausiert( int id )
 {
-	Text *befehl = new Text( "SELECT server_status_id FROM server_information WHERE id = " );
+	Text *befehl = new Text( "SELECT server_status_id FROM server WHERE id = " );
 	befehl->append( id );
 	lock();
 	if( !datenbank->befehl( befehl->getText() ) )
@@ -769,7 +647,7 @@ int ISDatenbank::getSpielerPunkte( int spielId, int accountId )
 
 Array< int > *ISDatenbank::getAccountSpielArtListe( int cId )
 {
-	Text *befehl = new Text( "SELECT a.spiel_art_id FROM spiel_art_account a, account_clients b "
+	Text *befehl = new Text( "SELECT a.spiel_art_id FROM spiel_art_account a, account_client b "
 							 "WHERE a.account_id = b.account_id AND a.end_dat IS NULL AND b.client_id = " );
 	befehl->append( cId );
 	lock();
@@ -815,7 +693,7 @@ int ISDatenbank::getNeusteSpielVersion( int sId )
 
 int ISDatenbank::getKupfer( int cId )
 {
-	Text *befehl = new Text( "SELECT a.kupfer FROM account a, account_clients b WHERE a.id = b.account_id AND b.client_id = " );
+	Text *befehl = new Text( "SELECT a.kupfer FROM account a, account_client b WHERE a.id = b.account_id AND b.client_id = " );
 	befehl->append( cId );
 	lock();
 	if( !datenbank->befehl( befehl->getText() ) )
@@ -887,7 +765,7 @@ Text *ISDatenbank::getDateiGruppePfad( int dgId )
 
 Array< int > *ISDatenbank::getAccountKarteListe( int cId, int sId )
 {
-	Text *befehl = new Text( "SELECT a.karte_id FROM karte_account a, account_clients b, karte c "
+	Text *befehl = new Text( "SELECT a.karte_id FROM karte_account a, account_client b, karte c "
 							 "WHERE c.id = a.karte_id AND a.account_id = b.account_id AND a.end_dat IS NULL AND b.client_id = " );
 	befehl->append( cId );
 	befehl->append( " AND c.spiel_art_id = " );
@@ -1891,7 +1769,7 @@ AHDaten *ISDatenbank::getSpielHistorie( int accountId, InformationServer *is )
 bool ISDatenbank::getHistorieServerPortIp( int clientId, int spielId, int *port, Text *ip )
 {
 	lock();
-	if( !datenbank->befehl( Text( "SELECT a.id, a.port, a.ip FROM server_historie a, server_historie_spiel b "
+	if( !datenbank->befehl( Text( "SELECT a.id, a.port, a.ip FROM server a, server_historie_spiel b "
 								  "WHERE a.id = b.server_historie_id AND a.clients < a.max_clients - 1 AND "
 								  "a.server_status_id = 3 AND b.spiel_id = " ) += spielId ) )
 	{
@@ -1909,21 +1787,15 @@ bool ISDatenbank::getHistorieServerPortIp( int clientId, int spielId, int *port,
 	*port = res.values[ 1 ];
 	*ip = res.values[ 2 ].getText();
 	res.destroy();
-	Text *befehl = new Text( "INSERT INTO server_historie_clients( client_id, server_historie_id ) VALUES ( " );
+	Text *befehl = new Text( "INSERT INTO server_client( client_id, server_id ) VALUES ( " );
 	befehl->append( clientId );
 	befehl->append( ", " );
 	befehl->append( id );
 	befehl->append( " )" );
 	bool ret = 1;
 	lock();
-	ret &= datenbank->befehl( Text( "SELECT server_historie_id FROM server_historie_clients WHERE client_id = " ) += clientId );
-	res = datenbank->getResult();
-	if( res.zeilenAnzahl )
-		ret &= datenbank->befehl( Text( "UPDATE server_historie SET clients = clients - 1 WHERE id = " ) += res.values[ 0 ] );
-	res.destroy();
-	ret &= datenbank->befehl( Text( "DELETE FROM server_historie_clients WHERE client_id = " ) += clientId );
+	ret &= datenbank->befehl( Text( "DELETE FROM server_client a USING server b WHERE b.server_typ_name = 'historie' AND b.id = a.server_id AND a.client_id = " ) += clientId );
 	ret &= datenbank->befehl( *befehl );
-	ret &= datenbank->befehl( Text( "UPDATE server_historie SET clients = clients + 1 WHERE id = " ) += id );
 	unlock();
 	befehl->release();
 	return ret;
@@ -1931,7 +1803,7 @@ bool ISDatenbank::getHistorieServerPortIp( int clientId, int spielId, int *port,
 
 bool ISDatenbank::hatKlientRecht( int kId, int recht )
 {
-	Text befehl = "SELECT a.* FROM account_user_rechte a, account_clients b WHERE a.account_id = b.account_id AND b.client_id = ";
+	Text befehl = "SELECT a.* FROM account_user_rechte a, account_client b WHERE a.account_id = b.account_id AND b.client_id = ";
 	befehl += kId;
 	befehl += " AND a.user_rechte_id = ";
 	befehl += recht;
@@ -1947,7 +1819,7 @@ Result ISDatenbank::getKartenListe( int kId, char *suchFilter, char sortSpalte,
 	Text befehl = "SELECT a.id, a.name, b.name, c.kupfer, a.verkauft, a.max_spieler FROM karte a ";
 	befehl += "INNER JOIN spiel_art b ON a.spiel_art_id = b.id ";
 	befehl += "LEFT JOIN karte_kauf_erlaubt c ON a.id = c.karte_id ";
-	befehl += "INNER JOIN account_clients d ON d.account_id = a.account_id ";
+	befehl += "INNER JOIN account_client d ON d.account_id = a.account_id ";
 	befehl += "WHERE d.client_id = ";
 	befehl += kId;
 	befehl += " AND a.name LIKE'%";
@@ -1970,7 +1842,7 @@ Result ISDatenbank::getKartenListe( int kId, char *suchFilter, char sortSpalte,
 
 bool ISDatenbank::getEditorServerPortIp( int clientId, int karteId, int *port, Text *ip )
 {
-	Text befehl = "SELECT a.port, a.ip, a.id FROM server_editor a, karte b, account_clients c ";
+	Text befehl = "SELECT a.port, a.ip, a.id FROM server a, karte b, account_client c ";
 	befehl += "WHERE a.id = b.server_editor_id AND b.account_id = c.account_id AND a.server_status_id = 3 AND c.client_id = ";
 	befehl += clientId;
 	befehl += " AND b.id = ";
@@ -1987,15 +1859,15 @@ bool ISDatenbank::getEditorServerPortIp( int clientId, int karteId, int *port, T
     ip->setText( res.values[ 1 ] );
     int id = res.values[ 2 ];
     res.destroy();
-    befehl = "INSERT INTO server_editor_clients( client_id, server_editor_id ) VALUES ( ";
+    befehl = "INSERT INTO server_client( client_id, server_id ) VALUES ( ";
     befehl += clientId;
     befehl += ", ";
     befehl += id;
     befehl += " )";
     bool ret = 1;
     lock();
-    ret &= datenbank->befehl( Text( "SELECT server_editor_id FROM server_editor_clients WHERE client_id = " ) += clientId );
-    ret &= datenbank->befehl( Text( "DELETE FROM server_editor_clients WHERE client_id = " ) += clientId );
+    ret &= datenbank->befehl( Text( "SELECT a.server_id FROM server_client a, server b WHERE a.server_id = b.id AND b.server_typ_name = 'editor' AND a.client_id = " ) += clientId );
+    ret &= datenbank->befehl( Text( "DELETE FROM server_client a USING server b WHERE b.id = a.server_id AND b.server_typ_name = 'editor' AND a.client_id = " ) += clientId );
     ret &= datenbank->befehl( befehl );
     unlock();
 	return 1;
@@ -2003,11 +1875,11 @@ bool ISDatenbank::getEditorServerPortIp( int clientId, int karteId, int *port, T
 
 bool ISDatenbank::getKartenServerPortIp( int clientId, int karteId, int *port, Text *ip )
 {
-    Text befehl = "SELECT a.port, a.ip, a.id FROM server_karten a, karte b ";
+    Text befehl = "SELECT a.port, a.ip, a.id FROM server a, karte b ";
     befehl += "WHERE a.id = b.server_karten_id AND a.server_status_id = 3 AND b.id = ";
     befehl += karteId;
     if( !karteId )
-        befehl = "SELECT port, ip, a.id FROM server_karten WHERE server_status_id = 3 LIMIT 1";
+        befehl = "SELECT port, ip, id FROM server WHERE server_typ_name = 'karten' AND server_status_id = 3 LIMIT 1";
     lock();
     if( !datenbank->befehl( befehl ) )
     {
@@ -2024,15 +1896,15 @@ bool ISDatenbank::getKartenServerPortIp( int clientId, int karteId, int *port, T
     res.destroy();
     if( clientId )
     {
-        befehl = "INSERT INTO server_karten_clients( client_id, server_karten_id ) VALUES ( ";
+        befehl = "INSERT INTO server_client( client_id, server_id ) VALUES ( ";
         befehl += clientId;
         befehl += ", ";
         befehl += id;
         befehl += " )";
         bool ret = 1;
         lock();
-        ret &= datenbank->befehl( Text( "SELECT server_karten_id FROM server_karten_clients WHERE client_id = " ) += clientId );
-        ret &= datenbank->befehl( Text( "DELETE FROM server_karten_clients WHERE client_id = " ) += clientId );
+        ret &= datenbank->befehl( Text( "SELECT a.server_id FROM server_client a, server b WHERE b.id = a.server_id AND b.server_typ_name = 'karten' AND a.client_id = " ) += clientId );
+        ret &= datenbank->befehl( Text( "DELETE FROM server_client a USING server b WHERE b.id = a.server_id AND b.server_typ_name = 'karten' AND a.client_id = " ) += clientId );
         ret &= datenbank->befehl( befehl );
         unlock();
     }

+ 4 - 6
InformationServer/Datenbank.h

@@ -11,10 +11,10 @@ using namespace sql;
 
 namespace Admin_Recht
 {
-	const int ISStarten = 0x00000014;
-	const int ISBeenden = 0x00000015;
-	const int ISPausieren = 0x00000016;
-	const int ISMCChange = 0x00000017;
+	const int ISStarten = 20;
+	const int ISBeenden = 21;
+	const int ISPausieren = 22;
+	const int ISMCChange = 23;
 }
 
 struct AHDaten;
@@ -40,10 +40,8 @@ public:
 	bool proveKlient( int num, int sNum );
 	Text *getKlientKey( int cId );
 	void unregisterKlient( int num, int sNum );
-	bool serverAnmelden( InitDatei *zIni );
 	bool setServerStatus( int id, int status );
 	bool setMaxClients( int id, int maxC );
-	int getAdminPort( int id );
 	bool serverIstNichtPausiert( int id );
 	Text *getInformationsText( char *typ );
 	bool istSpielErlaubt( int spielId );

+ 1 - 9
InformationServer/InformationServer.cpp

@@ -18,19 +18,11 @@ InformationServer::InformationServer( InitDatei *zIni )
 	gesendet = 0;
 	fehler = new Text();
 	ini = zIni->getThis();
-	if( !db->serverAnmelden( zIni ) )
-	{
-		std::cout << "IS: Der Server konnte nicht in die Datenbank eingetragen werden:\n";
-		Text *txt = db->getLetzterFehler();
-		std::cout << txt->getText() << "\nDas Programm wird beendet.";
-		txt->release();
-		exit( 1 );
-	}
 	id = *zIni->zWert( "ServerId" );
 	server = new Server();
 	aServer = new Server();
 	std::cout << "IS: Starten des Admin Servers...\n";
-	if( !aServer->verbinde( (unsigned short)db->getAdminPort( id ), 10 ) )
+	if( !aServer->verbinde( (unsigned short)TextZuInt( ini->zWert( "AdminServerPort" )->getText(), 10 ), 10 ) )
 	{
 		std::cout << "IS: Der Admin Server konnte nicht gestartet werden. Das Programm wird beendet.\n";
 		exit( 1 );

+ 10 - 6
InformationServer/InformationServer.vcxproj

@@ -35,13 +35,17 @@
   <ImportGroup Label="PropertySheets" />
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <RemoteProjectDir>$(RemoteRootDir)/Server/$(ProjectName)/Release</RemoteProjectDir>
-    <IncludePath>..\..\..\..\Allgemein\Framework;../../../Framework/Release;..\..\..\..\Allgemein\Network\Network;../../../Network/Release;..\..\..\..\Allgemein\sql\sql;../../../sql/Release;$(IncludePath)</IncludePath>
+    <RemoteProjectDir>$(RemoteRootDir)/Server/$(ProjectName)/release</RemoteProjectDir>
+    <IncludePath>..\..\..\..\Allgemein\Framework;../../../Framework/release;..\..\..\..\Allgemein\Network\Network;../../../Network/release;..\..\..\..\Allgemein\sql\sql;../../../sql/release;$(IncludePath)</IncludePath>
+    <OutDir>$(ProjectDir)bin\$(Platform)\release\</OutDir>
+    <IntDir>$(ProjectDir)obj\$(Platform)\release\</IntDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <RemoteProjectDir>$(RemoteRootDir)/Server/$(ProjectName)/Debug</RemoteProjectDir>
+    <RemoteProjectDir>$(RemoteRootDir)/Server/$(ProjectName)/debug</RemoteProjectDir>
     <TargetExt />
-    <IncludePath>..\..\..\..\Allgemein\Framework;../../../Framework/Debug;..\..\..\..\Allgemein\Network\Network;../../../Network/Debug;..\..\..\..\Allgemein\sql\sql;../../../sql/Debug;$(IncludePath)</IncludePath>
+    <IncludePath>..\..\..\..\Allgemein\Framework;../../../Framework/debug;..\..\..\..\Allgemein\Network\Network;../../../Network/debug;..\..\..\..\Allgemein\sql\sql;../../../sql/debug;$(IncludePath)</IncludePath>
+    <OutDir>$(ProjectDir)bin\$(Platform)\debug\</OutDir>
+    <IntDir>$(ProjectDir)obj\$(Platform)\debug\</IntDir>
   </PropertyGroup>
   <ItemGroup>
     <ClInclude Include="AccountHistorieDaten.h" />
@@ -58,14 +62,14 @@
   </ItemGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <Link>
-      <AdditionalLibraryDirectories>$(RemoteRootDir)/sql/Debug/bin/x64/debug;$(RemoteRootDir)/Network/Debug/bin/x64/debug;$(RemoteRootDir)/Framework/Debug/bin/x64/debug;/usr/lib/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>$(RemoteRootDir)/sql/debug/bin/x64/debug;$(RemoteRootDir)/Network/debug/bin/x64/debug;$(RemoteRootDir)/Framework/debug/bin/x64/debug;/usr/lib/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <LibraryDependencies>dbgFramework;dbgNetwork;dbgSQL;pq;pthread</LibraryDependencies>
       <AdditionalOptions>-Wl,-rpath,../lib %(AdditionalOptions)</AdditionalOptions>
     </Link>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <Link>
-      <AdditionalLibraryDirectories>$(RemoteRootDir)/sql/Release/bin/x64/release;$(RemoteRootDir)/Network/Release/bin/x64/release;$(RemoteRootDir)/Framework/Release/bin/x64/release;/usr/lib/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>$(RemoteRootDir)/sql/release/bin/x64/release;$(RemoteRootDir)/Network/release/bin/x64/release;$(RemoteRootDir)/Framework/release/bin/x64/release;/usr/lib/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <LibraryDependencies>Framework;Network;SQL;pq;pthread</LibraryDependencies>
       <AdditionalOptions>-Wl,-rpath,../lib %(AdditionalOptions)</AdditionalOptions>
     </Link>

+ 13 - 11
InformationServer/main.cpp

@@ -1,20 +1,15 @@
 #include "InformationServer.h"
-#ifdef WIN32
-#include <main.h>
-#endif
 #include <Zeit.h>
 #include <iostream>
 #include <fstream>
 #include <Globals.h>
 
-#ifdef WIN32
-int KSGStart Framework::Start( Startparam p )
-{
-#else
 int main()
 {
-    Framework::initFramework();
+#ifdef DEBUG
+    cd( "/test/information" );
 #endif
+    Framework::initFramework();
 	Zeit *z = getZeit();
 	Text *pfad = new Text( "../log/information/" );
 	pfad->append( z->getZeit( "y-m-d h-i-s.log" ) );
@@ -35,6 +30,16 @@ int main()
 		dat->release();
 		exit( 1 );
 	}
+    const char *wichtig[] = { "ServerId", "DBBenutzer", "DBPasswort", "DBName", "DBIP", "DBPort", "Aktiv" };
+    for( const char *w : wichtig )
+    {
+        if( !dat->wertExistiert( w ) )
+        {
+            std::cout << "IS: error: Der Wert '" << w << "' wurde nicht gefunden. Das Programm wird geschlossen.\n";
+            dat->release();
+            exit( 1 );
+        }
+    }
 
 	InformationServer *iServer = new InformationServer( dat );
 
@@ -43,13 +48,10 @@ int main()
 
 	iServer->ende();
 	iServer->release();
-	dat->speichern();
 	dat->release();
 	std::cout << "IS: Der Server ist heruntergefahren.\n";
 	file.close();
 	std::cout.rdbuf( sbuf );
-#ifndef WIN32
     Framework::releaseFramework();
-#endif
 	return 0;
 }