mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-03 15:35:17 +00:00
[#92,!13] Moved PgSqlConnection and PgSqlExchange to libkea-pgsql.
This commit is contained in:
@@ -1573,6 +1573,8 @@ AC_CONFIG_FILES([Makefile
|
|||||||
src/lib/log/tests/severity_test.sh
|
src/lib/log/tests/severity_test.sh
|
||||||
src/lib/log/tests/tempdir.h
|
src/lib/log/tests/tempdir.h
|
||||||
src/lib/mysql/Makefile
|
src/lib/mysql/Makefile
|
||||||
|
src/lib/pgsql/Makefile
|
||||||
|
src/lib/pgsql/tests/Makefile
|
||||||
src/lib/process/Makefile
|
src/lib/process/Makefile
|
||||||
src/lib/process/tests/Makefile
|
src/lib/process/tests/Makefile
|
||||||
src/lib/process/testutils/Makefile
|
src/lib/process/testutils/Makefile
|
||||||
|
@@ -101,6 +101,9 @@ kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
|
|||||||
if HAVE_MYSQL
|
if HAVE_MYSQL
|
||||||
kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/mysql/libkea-mysql.la
|
kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/mysql/libkea-mysql.la
|
||||||
endif
|
endif
|
||||||
|
if HAVE_PGSQL
|
||||||
|
kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
|
||||||
|
endif
|
||||||
|
|
||||||
kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
|
kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
|
||||||
kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
|
kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
|
||||||
|
@@ -89,6 +89,9 @@ d2_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
|
|||||||
if HAVE_MYSQL
|
if HAVE_MYSQL
|
||||||
d2_unittests_LDADD += $(top_builddir)/src/lib/mysql/libkea-mysql.la
|
d2_unittests_LDADD += $(top_builddir)/src/lib/mysql/libkea-mysql.la
|
||||||
endif
|
endif
|
||||||
|
if HAVE_PGSQL
|
||||||
|
d2_unittests_LDADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
|
||||||
|
endif
|
||||||
|
|
||||||
d2_unittests_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
|
d2_unittests_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
|
||||||
d2_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
|
d2_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
|
||||||
|
@@ -88,6 +88,9 @@ kea_dhcp4_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
|
|||||||
if HAVE_MYSQL
|
if HAVE_MYSQL
|
||||||
kea_dhcp4_LDADD += $(top_builddir)/src/lib/mysql/libkea-mysql.la
|
kea_dhcp4_LDADD += $(top_builddir)/src/lib/mysql/libkea-mysql.la
|
||||||
endif
|
endif
|
||||||
|
if HAVE_PGSQL
|
||||||
|
kea_dhcp4_LDADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
|
||||||
|
endif
|
||||||
|
|
||||||
kea_dhcp4_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
|
kea_dhcp4_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
|
||||||
kea_dhcp4_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
|
kea_dhcp4_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
|
||||||
|
@@ -131,6 +131,15 @@ dhcp4_unittests_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
|
|||||||
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
|
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
|
||||||
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/dhcp/tests/libdhcptest.la
|
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/dhcp/tests/libdhcptest.la
|
||||||
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
|
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
|
||||||
|
|
||||||
|
if HAVE_MYSQL
|
||||||
|
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/mysql/libkea-mysql.la
|
||||||
|
endif
|
||||||
|
if HAVE_PGSQL
|
||||||
|
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
|
||||||
|
endif
|
||||||
|
|
||||||
|
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
|
||||||
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
|
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
|
||||||
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
|
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
|
||||||
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
|
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
|
||||||
|
@@ -88,6 +88,9 @@ kea_dhcp6_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
|
|||||||
if HAVE_MYSQL
|
if HAVE_MYSQL
|
||||||
kea_dhcp6_LDADD += $(top_builddir)/src/lib/mysql/libkea-mysql.la
|
kea_dhcp6_LDADD += $(top_builddir)/src/lib/mysql/libkea-mysql.la
|
||||||
endif
|
endif
|
||||||
|
if HAVE_PGSQL
|
||||||
|
kea_dhcp6_LDADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
|
||||||
|
endif
|
||||||
|
|
||||||
kea_dhcp6_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
|
kea_dhcp6_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
|
||||||
kea_dhcp6_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
|
kea_dhcp6_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
|
||||||
|
@@ -139,6 +139,9 @@ dhcp6_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
|
|||||||
if HAVE_MYSQL
|
if HAVE_MYSQL
|
||||||
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/mysql/libkea-mysql.la
|
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/mysql/libkea-mysql.la
|
||||||
endif
|
endif
|
||||||
|
if HAVE_PGSQL
|
||||||
|
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
|
||||||
|
endif
|
||||||
|
|
||||||
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
|
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
|
||||||
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
|
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
|
||||||
|
@@ -61,6 +61,15 @@ kea_lfc_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
|
|||||||
kea_lfc_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
|
kea_lfc_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
|
||||||
kea_lfc_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
|
kea_lfc_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
|
||||||
kea_lfc_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
|
kea_lfc_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
|
||||||
|
|
||||||
|
if HAVE_MYSQL
|
||||||
|
kea_lfc_LDADD += $(top_builddir)/src/lib/mysql/libkea-mysql.la
|
||||||
|
endif
|
||||||
|
if HAVE_PGSQL
|
||||||
|
kea_lfc_LDADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
|
||||||
|
endif
|
||||||
|
|
||||||
|
kea_lfc_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
|
||||||
kea_lfc_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
|
kea_lfc_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
|
||||||
kea_lfc_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
|
kea_lfc_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
|
||||||
kea_lfc_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
|
kea_lfc_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
|
||||||
|
@@ -61,6 +61,16 @@ lfc_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
|
|||||||
lfc_unittests_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
|
lfc_unittests_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
|
||||||
lfc_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
|
lfc_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
|
||||||
lfc_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
|
lfc_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
|
||||||
|
|
||||||
|
if HAVE_MYSQL
|
||||||
|
lfc_unittests_LDADD += $(top_builddir)/src/lib/mysql/libkea-mysql.la
|
||||||
|
endif
|
||||||
|
if HAVE_PGSQL
|
||||||
|
lfc_unittests_LDADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
lfc_unittests_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
|
||||||
lfc_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
|
lfc_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
|
||||||
lfc_unittests_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
|
lfc_unittests_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
|
||||||
lfc_unittests_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
|
lfc_unittests_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
|
||||||
|
@@ -5,6 +5,10 @@ if HAVE_MYSQL
|
|||||||
SUBDIRS += mysql
|
SUBDIRS += mysql
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if HAVE_PGSQL
|
||||||
|
SUBDIRS += pgsql
|
||||||
|
endif
|
||||||
|
|
||||||
SUBDIRS += testutils hooks dhcp config stats asiodns dhcp_ddns eval \
|
SUBDIRS += testutils hooks dhcp config stats asiodns dhcp_ddns eval \
|
||||||
dhcpsrv cfgrpt \
|
dhcpsrv cfgrpt \
|
||||||
process http
|
process http
|
||||||
|
@@ -146,8 +146,6 @@ libkea_dhcpsrv_la_SOURCES += network.cc network.h
|
|||||||
libkea_dhcpsrv_la_SOURCES += network_state.cc network_state.h
|
libkea_dhcpsrv_la_SOURCES += network_state.cc network_state.h
|
||||||
|
|
||||||
if HAVE_PGSQL
|
if HAVE_PGSQL
|
||||||
libkea_dhcpsrv_la_SOURCES += pgsql_connection.cc pgsql_connection.h
|
|
||||||
libkea_dhcpsrv_la_SOURCES += pgsql_exchange.cc pgsql_exchange.h
|
|
||||||
libkea_dhcpsrv_la_SOURCES += pgsql_host_data_source.cc pgsql_host_data_source.h
|
libkea_dhcpsrv_la_SOURCES += pgsql_host_data_source.cc pgsql_host_data_source.h
|
||||||
libkea_dhcpsrv_la_SOURCES += pgsql_lease_mgr.cc pgsql_lease_mgr.h
|
libkea_dhcpsrv_la_SOURCES += pgsql_lease_mgr.cc pgsql_lease_mgr.h
|
||||||
endif
|
endif
|
||||||
@@ -218,6 +216,9 @@ libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
|
|||||||
if HAVE_MYSQL
|
if HAVE_MYSQL
|
||||||
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/mysql/libkea-mysql.la
|
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/mysql/libkea-mysql.la
|
||||||
endif
|
endif
|
||||||
|
if HAVE_PGSQL
|
||||||
|
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
|
||||||
|
endif
|
||||||
|
|
||||||
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/database/libkea-database.la
|
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/database/libkea-database.la
|
||||||
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/log/libkea-log.la
|
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/log/libkea-log.la
|
||||||
@@ -327,8 +328,6 @@ endif
|
|||||||
|
|
||||||
if HAVE_PGSQL
|
if HAVE_PGSQL
|
||||||
libkea_dhcpsrv_include_HEADERS += \
|
libkea_dhcpsrv_include_HEADERS += \
|
||||||
pgsql_connection.h \
|
|
||||||
pgsql_exchange.h \
|
|
||||||
pgsql_host_data_source.h \
|
pgsql_host_data_source.h \
|
||||||
pgsql_lease_mgr.h
|
pgsql_lease_mgr.h
|
||||||
endif
|
endif
|
||||||
|
@@ -8,8 +8,8 @@
|
|||||||
#define PGSQL_HOST_DATA_SOURCE_H
|
#define PGSQL_HOST_DATA_SOURCE_H
|
||||||
|
|
||||||
#include <dhcpsrv/base_host_data_source.h>
|
#include <dhcpsrv/base_host_data_source.h>
|
||||||
#include <dhcpsrv/pgsql_connection.h>
|
#include <pgsql/pgsql_connection.h>
|
||||||
#include <dhcpsrv/pgsql_exchange.h>
|
#include <pgsql/pgsql_exchange.h>
|
||||||
|
|
||||||
namespace isc {
|
namespace isc {
|
||||||
namespace dhcp {
|
namespace dhcp {
|
||||||
|
@@ -10,8 +10,8 @@
|
|||||||
#include <dhcp/hwaddr.h>
|
#include <dhcp/hwaddr.h>
|
||||||
#include <dhcpsrv/dhcpsrv_exceptions.h>
|
#include <dhcpsrv/dhcpsrv_exceptions.h>
|
||||||
#include <dhcpsrv/lease_mgr.h>
|
#include <dhcpsrv/lease_mgr.h>
|
||||||
#include <dhcpsrv/pgsql_connection.h>
|
#include <pgsql/pgsql_connection.h>
|
||||||
#include <dhcpsrv/pgsql_exchange.h>
|
#include <pgsql/pgsql_exchange.h>
|
||||||
|
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
#include <boost/utility.hpp>
|
#include <boost/utility.hpp>
|
||||||
@@ -588,7 +588,7 @@ private:
|
|||||||
///
|
///
|
||||||
/// @throw isc::db::DbOperationError An operation on the open database has
|
/// @throw isc::db::DbOperationError An operation on the open database has
|
||||||
/// failed.
|
/// failed.
|
||||||
bool addLeaseCommon(StatementIndex stindex, PsqlBindArray& bind_array);
|
bool addLeaseCommon(StatementIndex stindex, db::PsqlBindArray& bind_array);
|
||||||
|
|
||||||
/// @brief Get Lease Collection Common Code
|
/// @brief Get Lease Collection Common Code
|
||||||
///
|
///
|
||||||
@@ -611,7 +611,7 @@ private:
|
|||||||
/// @throw isc::db::MultipleRecords Multiple records were retrieved
|
/// @throw isc::db::MultipleRecords Multiple records were retrieved
|
||||||
/// from the database where only one was expected.
|
/// from the database where only one was expected.
|
||||||
template <typename Exchange, typename LeaseCollection>
|
template <typename Exchange, typename LeaseCollection>
|
||||||
void getLeaseCollection(StatementIndex stindex, PsqlBindArray& bind_array,
|
void getLeaseCollection(StatementIndex stindex, db::PsqlBindArray& bind_array,
|
||||||
Exchange& exchange, LeaseCollection& result,
|
Exchange& exchange, LeaseCollection& result,
|
||||||
bool single = false) const;
|
bool single = false) const;
|
||||||
|
|
||||||
@@ -631,7 +631,7 @@ private:
|
|||||||
/// failed.
|
/// failed.
|
||||||
/// @throw isc::db::MultipleRecords Multiple records were retrieved
|
/// @throw isc::db::MultipleRecords Multiple records were retrieved
|
||||||
/// from the database where only one was expected.
|
/// from the database where only one was expected.
|
||||||
void getLeaseCollection(StatementIndex stindex, PsqlBindArray& bind_array,
|
void getLeaseCollection(StatementIndex stindex, db::PsqlBindArray& bind_array,
|
||||||
Lease4Collection& result) const {
|
Lease4Collection& result) const {
|
||||||
getLeaseCollection(stindex, bind_array, exchange4_, result);
|
getLeaseCollection(stindex, bind_array, exchange4_, result);
|
||||||
}
|
}
|
||||||
@@ -651,7 +651,7 @@ private:
|
|||||||
/// failed.
|
/// failed.
|
||||||
/// @throw isc::db::MultipleRecords Multiple records were retrieved
|
/// @throw isc::db::MultipleRecords Multiple records were retrieved
|
||||||
/// from the database where only one was expected.
|
/// from the database where only one was expected.
|
||||||
void getLeaseCollection(StatementIndex stindex, PsqlBindArray& bind_array,
|
void getLeaseCollection(StatementIndex stindex, db::PsqlBindArray& bind_array,
|
||||||
Lease6Collection& result) const {
|
Lease6Collection& result) const {
|
||||||
getLeaseCollection(stindex, bind_array, exchange6_, result);
|
getLeaseCollection(stindex, bind_array, exchange6_, result);
|
||||||
}
|
}
|
||||||
@@ -665,7 +665,7 @@ private:
|
|||||||
/// @param stindex Index of statement being executed
|
/// @param stindex Index of statement being executed
|
||||||
/// @param bind_array array containing input parameters for the query
|
/// @param bind_array array containing input parameters for the query
|
||||||
/// @param lease Lease4 object returned
|
/// @param lease Lease4 object returned
|
||||||
void getLease(StatementIndex stindex, PsqlBindArray& bind_array,
|
void getLease(StatementIndex stindex, db::PsqlBindArray& bind_array,
|
||||||
Lease4Ptr& result) const;
|
Lease4Ptr& result) const;
|
||||||
|
|
||||||
/// @brief Get Lease6 Common Code
|
/// @brief Get Lease6 Common Code
|
||||||
@@ -677,7 +677,7 @@ private:
|
|||||||
/// @param stindex Index of statement being executed
|
/// @param stindex Index of statement being executed
|
||||||
/// @param bind_array array containing input parameters for the query
|
/// @param bind_array array containing input parameters for the query
|
||||||
/// @param lease Lease6 object returned
|
/// @param lease Lease6 object returned
|
||||||
void getLease(StatementIndex stindex, PsqlBindArray& bind_array,
|
void getLease(StatementIndex stindex, db::PsqlBindArray& bind_array,
|
||||||
Lease6Ptr& result) const;
|
Lease6Ptr& result) const;
|
||||||
|
|
||||||
/// @brief Get expired leases common code.
|
/// @brief Get expired leases common code.
|
||||||
@@ -715,7 +715,7 @@ private:
|
|||||||
/// @throw isc::db::DbOperationError An operation on the open database has
|
/// @throw isc::db::DbOperationError An operation on the open database has
|
||||||
/// failed.
|
/// failed.
|
||||||
template <typename LeasePtr>
|
template <typename LeasePtr>
|
||||||
void updateLeaseCommon(StatementIndex stindex, PsqlBindArray& bind_array,
|
void updateLeaseCommon(StatementIndex stindex, db::PsqlBindArray& bind_array,
|
||||||
const LeasePtr& lease);
|
const LeasePtr& lease);
|
||||||
|
|
||||||
/// @brief Delete lease common code
|
/// @brief Delete lease common code
|
||||||
@@ -733,7 +733,7 @@ private:
|
|||||||
/// @throw isc::db::DbOperationError An operation on the open database has
|
/// @throw isc::db::DbOperationError An operation on the open database has
|
||||||
/// failed.
|
/// failed.
|
||||||
uint64_t deleteLeaseCommon(StatementIndex stindex,
|
uint64_t deleteLeaseCommon(StatementIndex stindex,
|
||||||
PsqlBindArray& bind_array);
|
db::PsqlBindArray& bind_array);
|
||||||
|
|
||||||
/// @brief Delete expired-reclaimed leases.
|
/// @brief Delete expired-reclaimed leases.
|
||||||
///
|
///
|
||||||
@@ -755,7 +755,7 @@ private:
|
|||||||
boost::scoped_ptr<PgSqlLease6Exchange> exchange6_; ///< Exchange object
|
boost::scoped_ptr<PgSqlLease6Exchange> exchange6_; ///< Exchange object
|
||||||
|
|
||||||
/// PostgreSQL connection handle
|
/// PostgreSQL connection handle
|
||||||
PgSqlConnection conn_;
|
db::PgSqlConnection conn_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace dhcp
|
} // namespace dhcp
|
||||||
|
@@ -110,7 +110,6 @@ libdhcpsrv_unittests_SOURCES += mysql_lease_mgr_unittest.cc
|
|||||||
libdhcpsrv_unittests_SOURCES += mysql_host_data_source_unittest.cc
|
libdhcpsrv_unittests_SOURCES += mysql_host_data_source_unittest.cc
|
||||||
endif
|
endif
|
||||||
if HAVE_PGSQL
|
if HAVE_PGSQL
|
||||||
libdhcpsrv_unittests_SOURCES += pgsql_exchange_unittest.cc
|
|
||||||
libdhcpsrv_unittests_SOURCES += pgsql_lease_mgr_unittest.cc
|
libdhcpsrv_unittests_SOURCES += pgsql_lease_mgr_unittest.cc
|
||||||
libdhcpsrv_unittests_SOURCES += pgsql_host_data_source_unittest.cc
|
libdhcpsrv_unittests_SOURCES += pgsql_host_data_source_unittest.cc
|
||||||
endif
|
endif
|
||||||
@@ -174,6 +173,9 @@ libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
|
|||||||
if HAVE_MYSQL
|
if HAVE_MYSQL
|
||||||
libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/mysql/libkea-mysql.la
|
libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/mysql/libkea-mysql.la
|
||||||
endif
|
endif
|
||||||
|
if HAVE_PGSQL
|
||||||
|
libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
|
||||||
|
endif
|
||||||
|
|
||||||
libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
|
libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
|
||||||
libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
|
libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
|
||||||
|
@@ -10,13 +10,13 @@
|
|||||||
#include <dhcpsrv/tests/test_utils.h>
|
#include <dhcpsrv/tests/test_utils.h>
|
||||||
#include <exceptions/exceptions.h>
|
#include <exceptions/exceptions.h>
|
||||||
#include <dhcpsrv/host.h>
|
#include <dhcpsrv/host.h>
|
||||||
#include <dhcpsrv/pgsql_connection.h>
|
|
||||||
#include <dhcpsrv/pgsql_host_data_source.h>
|
#include <dhcpsrv/pgsql_host_data_source.h>
|
||||||
#include <dhcpsrv/testutils/generic_host_data_source_unittest.h>
|
#include <dhcpsrv/testutils/generic_host_data_source_unittest.h>
|
||||||
#include <dhcpsrv/testutils/pgsql_schema.h>
|
#include <dhcpsrv/testutils/pgsql_schema.h>
|
||||||
#include <dhcpsrv/testutils/host_data_source_utils.h>
|
#include <dhcpsrv/testutils/host_data_source_utils.h>
|
||||||
#include <dhcpsrv/host_mgr.h>
|
#include <dhcpsrv/host_mgr.h>
|
||||||
#include <dhcpsrv/host_data_source_factory.h>
|
#include <dhcpsrv/host_data_source_factory.h>
|
||||||
|
#include <pgsql/pgsql_connection.h>
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
@@ -8,11 +8,11 @@
|
|||||||
|
|
||||||
#include <asiolink/io_address.h>
|
#include <asiolink/io_address.h>
|
||||||
#include <dhcpsrv/lease_mgr_factory.h>
|
#include <dhcpsrv/lease_mgr_factory.h>
|
||||||
#include <dhcpsrv/pgsql_connection.h>
|
|
||||||
#include <dhcpsrv/pgsql_lease_mgr.h>
|
#include <dhcpsrv/pgsql_lease_mgr.h>
|
||||||
#include <dhcpsrv/tests/test_utils.h>
|
#include <dhcpsrv/tests/test_utils.h>
|
||||||
#include <dhcpsrv/tests/generic_lease_mgr_unittest.h>
|
#include <dhcpsrv/tests/generic_lease_mgr_unittest.h>
|
||||||
#include <dhcpsrv/testutils/pgsql_schema.h>
|
#include <dhcpsrv/testutils/pgsql_schema.h>
|
||||||
|
#include <pgsql/pgsql_connection.h>
|
||||||
#include <exceptions/exceptions.h>
|
#include <exceptions/exceptions.h>
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
@@ -33,11 +33,16 @@ endif
|
|||||||
|
|
||||||
libdhcpsrvtest_la_CXXFLAGS = $(AM_CXXFLAGS)
|
libdhcpsrvtest_la_CXXFLAGS = $(AM_CXXFLAGS)
|
||||||
libdhcpsrvtest_la_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
|
libdhcpsrvtest_la_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
|
||||||
|
|
||||||
|
libdhcpsrvtest_la_LIBADD =
|
||||||
|
|
||||||
if HAVE_MYSQL
|
if HAVE_MYSQL
|
||||||
libdhcpsrvtest_la_CPPFLAGS += $(MYSQL_CPPFLAGS)
|
libdhcpsrvtest_la_CPPFLAGS += $(MYSQL_CPPFLAGS)
|
||||||
|
libdhcpsrvtest_la_LIBADD += $(top_builddir)/src/lib/mysql/libkea-mysql.la
|
||||||
endif
|
endif
|
||||||
if HAVE_PGSQL
|
if HAVE_PGSQL
|
||||||
libdhcpsrvtest_la_CPPFLAGS += $(PGSQL_CPPFLAGS)
|
libdhcpsrvtest_la_CPPFLAGS += $(PGSQL_CPPFLAGS)
|
||||||
|
libdhcpsrvtest_la_LIBADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
|
||||||
endif
|
endif
|
||||||
if HAVE_CQL
|
if HAVE_CQL
|
||||||
libdhcpsrvtest_la_CPPFLAGS += $(CQL_CPPFLAGS)
|
libdhcpsrvtest_la_CPPFLAGS += $(CQL_CPPFLAGS)
|
||||||
@@ -54,7 +59,8 @@ if HAVE_CQL
|
|||||||
libdhcpsrvtest_la_LDFLAGS += $(CQL_LIBS)
|
libdhcpsrvtest_la_LDFLAGS += $(CQL_LIBS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
libdhcpsrvtest_la_LIBADD = $(top_builddir)/src/lib/database/libkea-database.la
|
|
||||||
|
libdhcpsrvtest_la_LIBADD += $(top_builddir)/src/lib/database/libkea-database.la
|
||||||
libdhcpsrvtest_la_LIBADD += $(top_builddir)/src/lib/cc/libkea-cc.la
|
libdhcpsrvtest_la_LIBADD += $(top_builddir)/src/lib/cc/libkea-cc.la
|
||||||
libdhcpsrvtest_la_LIBADD += $(top_builddir)/src/lib/log/libkea-log.la
|
libdhcpsrvtest_la_LIBADD += $(top_builddir)/src/lib/log/libkea-log.la
|
||||||
|
|
||||||
|
31
src/lib/pgsql/Makefile.am
Normal file
31
src/lib/pgsql/Makefile.am
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
SUBDIRS = . tests
|
||||||
|
|
||||||
|
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
|
||||||
|
AM_CPPFLAGS += $(BOOST_INCLUDES) $(PGSQL_CPPFLAGS)
|
||||||
|
|
||||||
|
AM_CXXFLAGS = $(KEA_CXXFLAGS)
|
||||||
|
|
||||||
|
CLEANFILES = *.gcno *.gcda
|
||||||
|
|
||||||
|
lib_LTLIBRARIES = libkea-pgsql.la
|
||||||
|
libkea_pgsql_la_SOURCES = pgsql_connection.cc pgsql_connection.h
|
||||||
|
libkea_pgsql_la_SOURCES += pgsql_exchange.cc pgsql_exchange.h
|
||||||
|
|
||||||
|
|
||||||
|
libkea_pgsql_la_LIBADD = $(top_builddir)/src/lib/database/libkea-database.la
|
||||||
|
libkea_pgsql_la_LIBADD += $(top_builddir)/src/lib/cc/libkea-cc.la
|
||||||
|
libkea_pgsql_la_LIBADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
|
||||||
|
libkea_pgsql_la_LIBADD += $(top_builddir)/src/lib/log/libkea-log.la
|
||||||
|
libkea_pgsql_la_LIBADD += $(top_builddir)/src/lib/util/threads/libkea-threads.la
|
||||||
|
libkea_pgsql_la_LIBADD += $(top_builddir)/src/lib/util/libkea-util.la
|
||||||
|
libkea_pgsql_la_LIBADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
|
||||||
|
libkea_pgsql_la_LIBADD += $(LOG4CPLUS_LIBS) $(BOOST_LIBS)
|
||||||
|
|
||||||
|
libkea_pgsql_la_LDFLAGS = -no-undefined -version-info 0:0:0
|
||||||
|
|
||||||
|
libkea_pgsql_la_LDFLAGS += $(PGSQL_LIBS)
|
||||||
|
|
||||||
|
# Specify the headers for copying into the installation directory tree.
|
||||||
|
libkea_pgsql_includedir = $(pkgincludedir)/database
|
||||||
|
libkea_pgsql_include_HEADERS = \
|
||||||
|
pgsql_connection.h
|
@@ -7,7 +7,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <database/db_log.h>
|
#include <database/db_log.h>
|
||||||
#include <dhcpsrv/pgsql_connection.h>
|
#include <pgsql/pgsql_connection.h>
|
||||||
|
|
||||||
// PostgreSQL errors should be tested based on the SQL state code. Each state
|
// PostgreSQL errors should be tested based on the SQL state code. Each state
|
||||||
// code is 5 decimal, ASCII, digits, the first two define the category of
|
// code is 5 decimal, ASCII, digits, the first two define the category of
|
||||||
@@ -25,11 +25,10 @@
|
|||||||
#define PGSQL_STATECODE_LEN 5
|
#define PGSQL_STATECODE_LEN 5
|
||||||
#include <utils/errcodes.h>
|
#include <utils/errcodes.h>
|
||||||
|
|
||||||
using namespace isc::db;
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace isc {
|
namespace isc {
|
||||||
namespace dhcp {
|
namespace db {
|
||||||
|
|
||||||
// Default connection timeout
|
// Default connection timeout
|
||||||
|
|
||||||
@@ -361,5 +360,5 @@ PgSqlConnection::rollback() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // end of isc::dhcp namespace
|
}; // end of isc::db namespace
|
||||||
}; // end of isc namespace
|
}; // end of isc namespace
|
@@ -15,7 +15,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
namespace isc {
|
namespace isc {
|
||||||
namespace dhcp {
|
namespace db {
|
||||||
|
|
||||||
/// @brief Define PostgreSQL backend version: 5.0
|
/// @brief Define PostgreSQL backend version: 5.0
|
||||||
const uint32_t PG_SCHEMA_VERSION_MAJOR = 5;
|
const uint32_t PG_SCHEMA_VERSION_MAJOR = 5;
|
||||||
@@ -423,7 +423,7 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // end of isc::dhcp namespace
|
}; // end of isc::db namespace
|
||||||
}; // end of isc namespace
|
}; // end of isc namespace
|
||||||
|
|
||||||
#endif // PGSQL_CONNECTION_H
|
#endif // PGSQL_CONNECTION_H
|
@@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <dhcpsrv/pgsql_exchange.h>
|
#include <pgsql/pgsql_exchange.h>
|
||||||
|
#include <pgsql/pgsql_connection.h>
|
||||||
|
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
@@ -14,10 +15,8 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
using namespace isc::db;
|
|
||||||
|
|
||||||
namespace isc {
|
namespace isc {
|
||||||
namespace dhcp {
|
namespace db {
|
||||||
|
|
||||||
const int PsqlBindArray::TEXT_FMT = 0;
|
const int PsqlBindArray::TEXT_FMT = 0;
|
||||||
const int PsqlBindArray::BINARY_FMT = 1;
|
const int PsqlBindArray::BINARY_FMT = 1;
|
||||||
@@ -298,5 +297,5 @@ PgSqlExchange::dumpRow(const PgSqlResult& r, int row) {
|
|||||||
return (stream.str());
|
return (stream.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // end of isc::dhcp namespace
|
}; // end of isc::db namespace
|
||||||
}; // end of isc namespace
|
}; // end of isc namespace
|
@@ -8,7 +8,7 @@
|
|||||||
#define PGSQL_EXCHANGE_H
|
#define PGSQL_EXCHANGE_H
|
||||||
|
|
||||||
#include <asiolink/io_address.h>
|
#include <asiolink/io_address.h>
|
||||||
#include <dhcpsrv/pgsql_connection.h>
|
#include <pgsql/pgsql_connection.h>
|
||||||
|
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
#include <boost/noncopyable.hpp>
|
#include <boost/noncopyable.hpp>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
namespace isc {
|
namespace isc {
|
||||||
namespace dhcp {
|
namespace db {
|
||||||
|
|
||||||
/// @brief Structure used to bind C++ input values to dynamic SQL parameters
|
/// @brief Structure used to bind C++ input values to dynamic SQL parameters
|
||||||
/// The structure contains three vectors which store the input values,
|
/// The structure contains three vectors which store the input values,
|
||||||
@@ -396,7 +396,7 @@ protected:
|
|||||||
std::vector<std::string>columns_;
|
std::vector<std::string>columns_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // end of isc::dhcp namespace
|
}; // end of isc::db namespace
|
||||||
}; // end of isc namespace
|
}; // end of isc namespace
|
||||||
|
|
||||||
#endif // PGSQL_EXCHANGE_H
|
#endif // PGSQL_EXCHANGE_H
|
1
src/lib/pgsql/tests/.gitignore
vendored
Normal file
1
src/lib/pgsql/tests/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/libpgsql_unittests
|
38
src/lib/pgsql/tests/Makefile.am
Normal file
38
src/lib/pgsql/tests/Makefile.am
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
SUBDIRS = .
|
||||||
|
|
||||||
|
AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
|
||||||
|
AM_CPPFLAGS += $(BOOST_INCLUDES)
|
||||||
|
|
||||||
|
AM_CXXFLAGS = $(KEA_CXXFLAGS)
|
||||||
|
|
||||||
|
if USE_STATIC_LINK
|
||||||
|
AM_LDFLAGS = -static
|
||||||
|
endif
|
||||||
|
|
||||||
|
CLEANFILES = *.gcno *.gcda
|
||||||
|
|
||||||
|
TESTS_ENVIRONMENT = \
|
||||||
|
$(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)
|
||||||
|
|
||||||
|
TESTS =
|
||||||
|
if HAVE_GTEST
|
||||||
|
TESTS += libpgsql_unittests
|
||||||
|
|
||||||
|
libpgsql_unittests_SOURCES = pgsql_exchange_unittest.cc
|
||||||
|
libpgsql_unittests_SOURCES += run_unittests.cc
|
||||||
|
|
||||||
|
libpgsql_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
|
||||||
|
libpgsql_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS) $(PGSQL_LIBS)
|
||||||
|
|
||||||
|
libpgsql_unittests_LDADD = $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
|
||||||
|
libpgsql_unittests_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
|
||||||
|
libpgsql_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
|
||||||
|
libpgsql_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
|
||||||
|
libpgsql_unittests_LDADD += $(top_builddir)/src/lib/util/threads/libkea-threads.la
|
||||||
|
libpgsql_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
|
||||||
|
libpgsql_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
|
||||||
|
libpgsql_unittests_LDADD += $(LOG4CPLUS_LIBS) $(BOOST_LIBS) $(GTEST_LDADD)
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
noinst_PROGRAMS = $(TESTS)
|
@@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <dhcpsrv/pgsql_connection.h>
|
#include <pgsql/pgsql_connection.h>
|
||||||
#include <dhcpsrv/pgsql_exchange.h>
|
#include <pgsql/pgsql_exchange.h>
|
||||||
|
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
using namespace isc;
|
using namespace isc;
|
||||||
using namespace isc::db;
|
using namespace isc::db;
|
||||||
using namespace isc::dhcp;
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
20
src/lib/pgsql/tests/run_unittests.cc
Normal file
20
src/lib/pgsql/tests/run_unittests.cc
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
|
||||||
|
//
|
||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <log/logger_support.h>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char* argv[]) {
|
||||||
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
isc::log::initLogger();
|
||||||
|
|
||||||
|
int result = RUN_ALL_TESTS();
|
||||||
|
|
||||||
|
return (result);
|
||||||
|
}
|
@@ -59,6 +59,9 @@ libkea_process_la_LIBADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
|
|||||||
if HAVE_MYSQL
|
if HAVE_MYSQL
|
||||||
libkea_process_la_LIBADD += $(top_builddir)/src/lib/mysql/libkea-mysql.la
|
libkea_process_la_LIBADD += $(top_builddir)/src/lib/mysql/libkea-mysql.la
|
||||||
endif
|
endif
|
||||||
|
if HAVE_PGSQL
|
||||||
|
libkea_process_la_LIBADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
|
||||||
|
endif
|
||||||
|
|
||||||
libkea_process_la_LIBADD += $(top_builddir)/src/lib/database/libkea-database.la
|
libkea_process_la_LIBADD += $(top_builddir)/src/lib/database/libkea-database.la
|
||||||
libkea_process_la_LIBADD += $(top_builddir)/src/lib/cc/libkea-cc.la
|
libkea_process_la_LIBADD += $(top_builddir)/src/lib/cc/libkea-cc.la
|
||||||
|
Reference in New Issue
Block a user