Datenbank.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef Datenbank_H
  2. #define Datenbank_H
  3. #include <sql.h>
  4. #include <Text.h>
  5. #include <InitDatei.h>
  6. using namespace Framework;
  7. using namespace sql;
  8. namespace Admin_Recht
  9. {
  10. const int HSStarten = 0x00000029;
  11. const int HSBeenden = 0x0000002A;
  12. const int HSPausieren = 0x0000002B;
  13. const int HSMCChange = 0x0000002C;
  14. const int HSMSChange = 0x0000002D;
  15. }
  16. class HSDatenbank
  17. {
  18. private:
  19. Datenbank *datenbank;
  20. CRITICAL_SECTION cs;
  21. int ref;
  22. public:
  23. // Konstruktor
  24. HSDatenbank( InitDatei *zIni );
  25. // Destruktor
  26. ~HSDatenbank();
  27. // nicht constant
  28. void lock();
  29. void unlock();
  30. int istAdministrator( const char *name, const char *passwort );
  31. bool adminHatRecht( int id, int recht );
  32. bool proveKlient( int num, int sNum );
  33. Text *getKlientKey( int cId );
  34. void unregisterKlient( int num, int sNum );
  35. bool serverAnmelden( InitDatei *zIni );
  36. bool setServerStatus( int id, int status );
  37. bool setMaxClients( int id, int maxC );
  38. bool setMaxSpiele( int id, int maxS );
  39. int getAdminPort( int id );
  40. bool serverIstNichtPausiert( int id );
  41. bool getSpielServerPortIp( int id, short *port, Text *ip );
  42. bool istSpielHistorieFrei( int id );
  43. bool addSpielHistorie( int server, int spiel );
  44. // constant
  45. Text *getLetzterFehler() const;
  46. // Reference Counting
  47. HSDatenbank *getThis();
  48. HSDatenbank *release();
  49. };
  50. #endif