BIND 10 trac2821, updated. 17c0037b8ab08e7aaa1a9eee9e1a0753308b2ce2 [2821] Move library_end to holder
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Mar 8 11:01:20 UTC 2013
The branch, trac2821 has been updated
via 17c0037b8ab08e7aaa1a9eee9e1a0753308b2ce2 (commit)
from b11b84e52dd4670259d7c0a59d2e7cee4550b16a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 17c0037b8ab08e7aaa1a9eee9e1a0753308b2ce2
Author: Jelte Jansen <jelte at isc.org>
Date: Fri Mar 8 12:01:03 2013 +0100
[2821] Move library_end to holder
and use the holder in the unit tests as well
-----------------------------------------------------------------------
Summary of changes:
src/lib/dhcpsrv/mysql_lease_mgr.h | 2 ++
src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc | 22 ++++++---------------
src/lib/dhcpsrv/tests/run_unittests.cc | 8 --------
3 files changed, 8 insertions(+), 24 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/dhcpsrv/mysql_lease_mgr.h b/src/lib/dhcpsrv/mysql_lease_mgr.h
index e3bc040..390c24f 100644
--- a/src/lib/dhcpsrv/mysql_lease_mgr.h
+++ b/src/lib/dhcpsrv/mysql_lease_mgr.h
@@ -59,6 +59,8 @@ public:
if (mysql_ != NULL) {
mysql_close(mysql_);
}
+ // The library itself shouldn't be needed anymore
+ mysql_library_end();
}
/// @brief Conversion Operator
diff --git a/src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc
index ddb2645..2ae6a49 100644
--- a/src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc
+++ b/src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc
@@ -118,21 +118,16 @@ validConnectionString() {
// There is no error checking in this code: if something fails, one of the
// tests will (should) fall over.
void destroySchema() {
- // Initialise
- MYSQL handle;
- (void) mysql_init(&handle);
+ MySqlHolder mysql;
// Open database
- (void) mysql_real_connect(&handle, "localhost", "keatest",
+ (void) mysql_real_connect(mysql, "localhost", "keatest",
"keatest", "keatest", 0, NULL, 0);
// Get rid of everything in it.
for (int i = 0; destroy_statement[i] != NULL; ++i) {
- (void) mysql_query(&handle, destroy_statement[i]);
+ (void) mysql_query(mysql, destroy_statement[i]);
}
-
- // ... and close
- (void) mysql_close(&handle);
}
// @brief Create the Schema
@@ -142,21 +137,16 @@ void destroySchema() {
// There is no error checking in this code: if it fails, one of the tests
// will fall over.
void createSchema() {
- // Initialise
- MYSQL handle;
- (void) mysql_init(&handle);
+ MySqlHolder mysql;
// Open database
- (void) mysql_real_connect(&handle, "localhost", "keatest",
+ (void) mysql_real_connect(mysql, "localhost", "keatest",
"keatest", "keatest", 0, NULL, 0);
// Execute creation statements.
for (int i = 0; create_statement[i] != NULL; ++i) {
- (void) mysql_query(&handle, create_statement[i]);
+ (void) mysql_query(mysql, create_statement[i]);
}
-
- // ... and close
- (void) mysql_close(&handle);
}
/// @brief Test fixture class for testing MySQL Lease Manager
diff --git a/src/lib/dhcpsrv/tests/run_unittests.cc b/src/lib/dhcpsrv/tests/run_unittests.cc
index 8235c59..dcc0204 100644
--- a/src/lib/dhcpsrv/tests/run_unittests.cc
+++ b/src/lib/dhcpsrv/tests/run_unittests.cc
@@ -17,10 +17,6 @@
#include <gtest/gtest.h>
-#ifdef HAVE_MYSQL
-#include <mysql/mysql.h>
-#endif
-
int
main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv);
@@ -28,9 +24,5 @@ main(int argc, char* argv[]) {
int result = RUN_ALL_TESTS();
-#ifdef HAVE_MYSQL
- mysql_library_end();
-#endif
-
return (result);
}
More information about the bind10-changes
mailing list