Enable automatic compilation and unit test verification
refs #2691
Change-Id: I0ab113fc9c4d481a74534fb8105a87dde8f76a12
diff --git a/catalog/src/main.cpp b/catalog/src/main.cpp
index d5f89ee..6e2fae1 100644
--- a/catalog/src/main.cpp
+++ b/catalog/src/main.cpp
@@ -22,7 +22,7 @@
#include <ChronoSync/socket.hpp>
#include <ndn-cxx/face.hpp>
#include <json/value.h>
-#include <libpq-fe.h>
+#include <mysql.h>
using namespace std;
using namespace ndn;
@@ -33,12 +33,11 @@
shared_ptr<chronosync::Socket> socket; // use ChronoSync
Json::Value root; // use jsoncpp
- PGconn *conn; // use libpq
- // Make a connection to the database
- conn = PQconnectdb("dbname=bedrock sslmode=disable");
- if (PQstatus(conn) != CONNECTION_OK) {
- cout << "Connection to database failed: "
- << PQerrorMessage(conn) << endl;
+ MYSQL *con = mysql_init(NULL);
+ if (con == NULL)
+ {
+ fprintf(stderr, "%s\n", mysql_error(con));
+ return 1;
}
return 0;
diff --git a/catalog/tests/unit-tests/simple.cpp b/catalog/tests/unit-tests/simple.cpp
index 01ae66a..970b835 100644
--- a/catalog/tests/unit-tests/simple.cpp
+++ b/catalog/tests/unit-tests/simple.cpp
@@ -20,10 +20,10 @@
*/
#include <boost/test/unit_test.hpp>
-#include <libpq-fe.h>
#include <json/value.h>
#include <json/writer.h>
#include <json/reader.h>
+#include <mysql.h>
#include <iostream>
namespace NdnAtmos {
@@ -38,9 +38,8 @@
BOOST_AUTO_TEST_CASE(DBTest)
{
- PGconn *conn;
- conn = PQconnectdb("dbname=test sslmode=disable");
- BOOST_CHECK_EQUAL(PQstatus(conn) != CONNECTION_OK, true);
+ MYSQL *conn = mysql_init(NULL);
+ BOOST_CHECK_EQUAL(conn == NULL, false);
}
BOOST_AUTO_TEST_CASE(JsonTest)