Commit 52fe5e23 authored by Francis Dupont's avatar Francis Dupont
Browse files

[3882a] Added new getDBVersion() class method

parent 07dcd39f
......@@ -61,5 +61,10 @@ LeaseMgr::getLease6(Lease::Type type, const DUID& duid,
return (*col.begin());
}
std::string
LeaseMgr::getDBVersion() {
isc_throw(NotImplemented, "LeaseMgr::getDBVersion() called");
}
} // namespace isc::dhcp
} // namespace isc
......@@ -152,6 +152,10 @@ public:
virtual ~LeaseMgr()
{}
/// @brief Class method to return extended version info
/// This class method must be redeclared and redefined in derived classes
static std::string getDBVersion();
/// @brief Adds an IPv4 lease.
///
/// @param lease lease to be added
......
......@@ -265,6 +265,14 @@ Memfile_LeaseMgr::~Memfile_LeaseMgr() {
}
}
std::string
Memfile_LeaseMgr::getDBVersion() {
std::stringstream tmp;
tmp << "Memfile backend " << MAJOR_VERSION;
tmp << "." << MINOR_VERSION;
return (tmp.str());
}
bool
Memfile_LeaseMgr::addLease(const Lease4Ptr& lease) {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
......
......@@ -134,6 +134,9 @@ public:
/// @brief Destructor (closes file)
virtual ~Memfile_LeaseMgr();
/// @brief Local version of getDBVersion() class method
static std::string getDBVersion();
/// @brief Adds an IPv4 lease.
///
/// @param lease lease to be added
......
......@@ -1265,6 +1265,15 @@ MySqlLeaseMgr::~MySqlLeaseMgr() {
// closed in the destructor of the mysql_ member variable.
}
std::string
MySqlLeaseMgr::getDBVersion() {
std::stringstream tmp;
tmp << "MySQL backend " << CURRENT_VERSION_VERSION;
tmp << "." << CURRENT_VERSION_MINOR;
tmp << " library " << mysql_get_client_info();
return (tmp.str());
}
// Time conversion methods.
//
......
......@@ -122,6 +122,9 @@ public:
/// @brief Destructor (closes database)
virtual ~MySqlLeaseMgr();
/// @brief Local version of getDBVersion() class method
static std::string getDBVersion();
/// @brief Adds an IPv4 lease
///
/// @param lease lease to be added
......
......@@ -965,6 +965,15 @@ PgSqlLeaseMgr::~PgSqlLeaseMgr() {
}
}
std::string
PgSqlLeaseMgr::getDBVersion() {
std::stringstream tmp;
tmp << "PostgreSQL backend " << PG_CURRENT_VERSION;
tmp << "." << PG_CURRENT_MINOR;
tmp << " library " << PQlibVersion();
return (tmp.str());
}
void
PgSqlLeaseMgr::prepareStatements() {
for(int i = 0; tagged_statements[i].text != NULL; ++ i) {
......
......@@ -151,6 +151,9 @@ public:
/// @brief Destructor (closes database)
virtual ~PgSqlLeaseMgr();
/// @brief Local version of getDBVersion() class method
static std::string getDBVersion();
/// @brief Adds an IPv4 lease
///
/// @param lease lease to be added
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment