All pastes #596480 Raw Edit

Miscellany

public text v1 · immutable
#596480 ·published 2007-06-29 23:54 UTC
rendered paste body
#ifndef DATABASEMANAGER_H_INCLUDED
#define DATABASEMANAGER_H_INCLUDED

#include "UWD.h"
#include <iostream>
#include <string>
#include <pqxx/pqxx>

namespace UWD {
    /*!
	* \brief
	* DatabaseManager class
	*
	*/
    class DatabaseManager {
        private:
            /*! \brief DatabaseManager constructor.*/
            DatabaseManager(const std::string &dbConnectString);
            ~DatabaseManager();

            // Singleton Related
            static DatabaseManager mDatabaseManager;
            DatabaseManager& operator=(DatabaseManager&);  // Disallowed in Singleton
            DatabaseManager(const DatabaseManager&);       // Disallowed in Singleton
            // End Singleton Related

            LogManager& mLogManager;

            pqxx::connection C;

        public:
            /*! \brief getSingleton returns a reference to the DatabaseManager singleton. */
            static DatabaseManager& getSingleton();

            // SQL Queries
            /*!
             * \brief
             * Checks if sPasswordHash is a valid password for sAccountName
             *
             * Accesses the uw_account table in the database and checks to see if sPasswordHash
             * is the same as the one provided by the user. It returns true if the authentication
             * was successful, and false if it was not.
             */
            bool queryAuthenticateAccount(std::string sAccountName, std::string sPasswordHash);



	};
}


#endif // DATABASEMANAGER_H_INCLUDED