// mariadb_test.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include using namespace std; class MySql { public: MySql() { mysql = mysql_init(NULL); } ~MySql() { if(mysql) { mysql_close(mysql); } mysql_thread_end(); } /* int Connect(const char *host, const char *user, const char *passwd, const char *db, unsigned int port, const char *unix_socket, unsigned long clientflag) { if(!mysql_real_connect(mysql, host,user, passwd, db, port, unix_socket, clientflag)) { return 1; } return 0; } int Execute(const char *query) { int status = mysql_query(mysql, query); return status; }*/ private: MYSQL * mysql; }; void syncmysqldbs(); int main(int argc, _TCHAR* argv[]) { int i = mysql_library_init(0, NULL, NULL); syncmysqldbs(); //mysql_library_end(); return 0; } void syncmysqldbs() { MySql mysqlsrc; MySql mysqldest; //Production server //if(!mysqlsrc.Connect("localhost","root", "root", NULL, 3306, NULL, 0)) //{ // cout<<"Connection to Src Failed"; // return; //} ////Test Server //if(!mysqldest.Connect("localhost","root", "root", NULL, 3306, NULL, 0)) //{ // cout<<"Connection to Destn Failed"; // return; //} /// Sync databases. Read data from first server and write it to second server }