BIND 10 trac2042, updated. 4f08254003eb525073f88a2dd6181deb66469f3a [2042] MySQL insertLease4 is now working.
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Jul 11 15:13:19 UTC 2012
The branch, trac2042 has been updated
via 4f08254003eb525073f88a2dd6181deb66469f3a (commit)
from 1db0c25926efb74cd4f2711ac3a72d58d0bda54a (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 4f08254003eb525073f88a2dd6181deb66469f3a
Author: Tomek Mrugalski <tomasz at isc.org>
Date: Wed Jul 11 17:13:02 2012 +0200
[2042] MySQL insertLease4 is now working.
-----------------------------------------------------------------------
Summary of changes:
tests/tools/dhcp-ubench/mysql_ubench.cc | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
-----------------------------------------------------------------------
diff --git a/tests/tools/dhcp-ubench/mysql_ubench.cc b/tests/tools/dhcp-ubench/mysql_ubench.cc
index 9b9b504..6bce65a 100644
--- a/tests/tools/dhcp-ubench/mysql_ubench.cc
+++ b/tests/tools/dhcp-ubench/mysql_ubench.cc
@@ -10,6 +10,7 @@ using namespace std;
const char * hostname ="localhost";
const char * user = "root";
const char * passwd = "foobletch";
+const char * dbname = "kea";
void failure(MYSQL* conn, const char* operation) {
stringstream tmp;
@@ -28,12 +29,17 @@ MYSQL * connect() {
cout << "MySQL library init successful." << endl;
}
- if (!mysql_real_connect(conn, hostname, user, passwd, NULL, 0, NULL, 0)) {
+ if (!mysql_real_connect(conn, hostname, user, passwd, dbname, 0, NULL, 0)) {
failure(conn, "connecting to MySQL server");
} else {
cout << "MySQL connection established." << endl;
}
+ string q = "delete from lease4";
+ if (mysql_real_query(conn, q.c_str(), strlen(q.c_str()))) {
+ failure(conn, "dropping old lease4 entries.");
+ }
+
return (conn);
}
@@ -79,6 +85,8 @@ bool createLease4Test(MYSQL * conn, uint32_t num) {
stringstream cltt;
cltt << "2012-07-11 15:43:" << (i % 60);
+ addr++;
+
// the first address is 1.0.0.0.
char query[2000], * end;
strcpy(query, "INSERT INTO lease4(addr,hwaddr,client_id,"
@@ -96,13 +104,17 @@ bool createLease4Test(MYSQL * conn, uint32_t num) {
// lease_id field is set automatically
// options and comments fields are not set
- cout << "QUERY=[" << query << "]" << endl;
-
unsigned int len = end - query;
if (mysql_real_query(conn, query, len)) {
// something failed.
- }
+ failure(conn, "INSERT query");
+ } else {
+ printf(".");
+ fflush(stdout);
+ };
}
+ printf("\n");
+ fflush(stdout);
}
bool searchLease4Test(MYSQL * conn, uint32_t num) {
@@ -127,7 +139,7 @@ int main(int argc, const char * argv[]) {
cout << "MySQL client version is " << mysql_get_client_info() << endl;
- uint32_t num = 1;
+ uint32_t num = 100;
try {
MYSQL *conn = connect();
More information about the bind10-changes
mailing list