#include "DBuntil.h" #include #include #include MYSQL myCont; MYSQL_RES *result; MYSQL_ROW sql_row; DBuntil::DBuntil() {} DBuntil::DBuntil(my_db mydb) { if(mysql_init(&myCont)!=NULL) { std::cout<<"init succeed"<f_id ); std::cout<<"==========start============"<f_id="<f_id<p_id = atoi( sql_row[0]); per->name = sql_row[1]; std::cout<<"per->p_id="<p_id<name="<name<f_id="<f_id<name ); res = mysql_query(&myCont,sql); if(!res) { sprintf( sql, "INSERT INTO face_person(p_id, face_id) VALUES (LAST_INSERT_ID(), %d)" , per->f_id ); res = mysql_query(&myCont,sql); if(!res) { return true; } } return false; } bool DBuntil::db_register(person *per) { if(db_add(per)) { return true; } return false; }