From eb68a1e3ad5fb24b4c674b8f2fd529b8302c7d97 Mon Sep 17 00:00:00 2001 From: pans <pans@454eff88-639b-444f-9e54-f578c98de674> Date: 星期五, 30 十二月 2016 13:48:14 +0800 Subject: [PATCH] --- RtspFace/demo/src/db/DBuntil.cpp | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/RtspFace/demo/src/db/DBuntil.cpp b/RtspFace/demo/src/db/DBuntil.cpp index 3787225..e4c11cf 100644 --- a/RtspFace/demo/src/db/DBuntil.cpp +++ b/RtspFace/demo/src/db/DBuntil.cpp @@ -1,9 +1,10 @@ #include "DBuntil.h" #include <mysql.h> #include <cstdio> +#include <iostream> const char DBuntil::user[] = "root"; -const char DBuntil::pswd[] = ""; +const char DBuntil::pswd[] = "Basic@2017"; const char DBuntil::host[] = "localhost"; const char DBuntil::db[] = "demo"; unsigned int DBuntil::port = 3306; @@ -11,12 +12,18 @@ MYSQL myCont; MYSQL_RES *result; MYSQL_ROW sql_row; -#pragma comment(lib,"D:\\Program Files\\mysql-5.7.17-winx64\\lib\\libmysql.lib") DBuntil::DBuntil() { - mysql_init(&myCont); - mysql_real_connect(&myCont, host, user, pswd, db, port, NULL, 0); + if(mysql_init(&myCont)!=NULL){ + std::cout<<"init succeed"<<std::endl; + }else + std::cout<<"init failed"<<std::endl; + + if(mysql_real_connect(&myCont, host, user, pswd, db, port, NULL, 0) != NULL){ + std::cout<<"mysql_real_connect succeed"<<std::endl; + }else + std::cout<<"mysql_real_connect failed"<<std::endl; } DBuntil::~DBuntil() @@ -58,7 +65,7 @@ } else { - //cout << "query sql failed!" << endl; + std::cout<<"query sql failed!"<<std::endl; } return per->p_id; } -- Gitblit v1.8.0