
#ifndef CONNEXION_H
#define CONNEXION_H

#include <QObject>
#include <QSqlDatabase>

namespace Common {

class Connexion : public QObject
{
    Q_OBJECT
    public:
        enum DatabaseDriver {
            Driver_SQLite = 0,
            Driver_MySQL,
            Driver_PostGreSQL,
            };

        Connexion(QObject *parent = 0);
        ~Connexion();
        bool connect();
        const QString getNameOfBase();
        QSqlDatabase m_db;
        QString BASE ;
    private:
        bool createDatabaseSchema(int driver) ;
        bool createDatabase(int driver) ;
        bool createFirstSqlConnection() const;
        bool isDatabaseCorrupted(const int driver,QSqlDatabase &);
        bool setFirstDefaultValues();
    
    private:
        bool m_IsDBConfigured;
        
    
};

} // End namespace Common

#endif   // Connexion_H
