git-svn-id: http://192.168.1.226/svn/proxy@58 454eff88-639b-444f-9e54-f578c98de674
| | |
| | | #include "DBuntil.h"
|
| | | #include <mysql.h>
|
| | | #include <cstdio>
|
| | | #include <iostream>
|
| | |
|
| | | const char DBuntil::user[] = "root";
|
| | | const char DBuntil::pswd[] = "Basic@2017";
|
| | |
| | | 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()
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | //cout << "query sql failed!" << endl;
|
| | | std::cout<<"query sql failed!"<<std::endl;
|
| | | }
|
| | | return per->p_id;
|
| | | }
|