| 1 |
////////////////////////////////////////////////////////////////////////////// |
| 2 |
////////////////////////////////////////////////////////////////////////////// |
| 3 |
// |
| 4 |
// copyright : (C) 2014 Eran Ifrah |
| 5 |
// file name : dbconnection.h |
| 6 |
// |
| 7 |
// ------------------------------------------------------------------------- |
| 8 |
// A |
| 9 |
// _____ _ _ _ _ |
| 10 |
// / __ \ | | | | (_) | |
| 11 |
// | / \/ ___ __| | ___| | _| |_ ___ |
| 12 |
// | | / _ \ / _ |/ _ \ | | | __/ _ ) |
| 13 |
// | \__/\ (_) | (_| | __/ |___| | || __/ |
| 14 |
// \____/\___/ \__,_|\___\_____/_|\__\___| |
| 15 |
// |
| 16 |
// F i l e |
| 17 |
// |
| 18 |
// This program is free software; you can redistribute it and/or modify |
| 19 |
// it under the terms of the GNU General Public License as published by |
| 20 |
// the Free Software Foundation; either version 2 of the License, or |
| 21 |
// (at your option) any later version. |
| 22 |
// |
| 23 |
////////////////////////////////////////////////////////////////////////////// |
| 24 |
////////////////////////////////////////////////////////////////////////////// |
| 25 |
|
| 26 |
#ifndef DBCONNECTION_H |
| 27 |
#define DBCONNECTION_H |
| 28 |
|
| 29 |
#include <wx/wx.h> |
| 30 |
#include <wx/dblayer/include/DatabaseResultSet.h> |
| 31 |
#include <wx/wxxmlserializer/XmlSerializer.h> |
| 32 |
#include "IDbAdapter.h" |
| 33 |
/*! \brief Class representing one db connection */ |
| 34 |
class DbConnection : public xsSerializable { |
| 35 |
|
| 36 |
public: |
| 37 |
XS_DECLARE_CLONABLE_CLASS(DbConnection); |
| 38 |
/*! \brief Default constructors */ |
| 39 |
DbConnection(); |
| 40 |
DbConnection(IDbAdapter* dbAdapter, const wxString& serverName); |
| 41 |
DbConnection(const DbConnection& obj); |
| 42 |
/*! \brief Default destructor */ |
| 43 |
virtual ~DbConnection(); |
| 44 |
/*! \brief Return server name */ |
| 45 |
wxString GetServerName() { return m_serverName; } |
| 46 |
/*! \brief Load databases from connection */ |
| 47 |
void Load(); |
| 48 |
/*! \brief Return IDbAdapter */ |
| 49 |
IDbAdapter* GetDbAdapter() { return m_pDbAdapter; } |
| 50 |
/*! \brief Refresh all children. (databases) */ |
| 51 |
void RefreshChildren(); |
| 52 |
|
| 53 |
protected: |
| 54 |
IDbAdapter* m_pDbAdapter; |
| 55 |
wxString m_serverName; |
| 56 |
}; |
| 57 |
|
| 58 |
#endif // DBCONNECTION_H |