| | |
| | | bool DBuntil::db_select(person* per)
|
| | | {
|
| | | std::cout<<"db_select start"<<std::endl;
|
| | | sprintf( sql, "select a.p_id,b.`name`,b.img from face_person a,user_info b where a.face_id = %d AND a.p_id = b.pid " ,per->f_id );
|
| | |
|
| | | sprintf( sql, "select a.p_id,b.name,b.img from face_person a,user_info b where a.face_id = %d AND a.p_id = b.pid " ,per->f_id );
|
| | | std::cout<<"==========start============"<<std::endl;
|
| | | std::cout<<"per->f_id="<<per->f_id<<std::endl;
|
| | | std::cout<<sql<<std::endl;
|
| | | std::cout<<"==========end=============="<<std::endl;
|
| | | mysql_query(&myCont, "SET NAMES utf8"); //设置编码格式
|
| | | res = mysql_query(&myCont,sql);//查询
|
| | | if (!res)
|
| | | {
|
| | | result = mysql_store_result(&myCont);
|
| | | if (result)
|
| | | if (result != NULL)
|
| | | {
|
| | | while (sql_row = mysql_fetch_row(result))
|
| | | {
|
| | | //获取具体的数据
|
| | | per->p_id = atoi( sql_row[0]);
|
| | | per->name = sql_row[1];
|
| | |
|
| | | std::cout<<"per->p_id="<<per->p_id<<std::endl;
|
| | | std::cout<<"per->name="<<per->name<<std::endl;
|
| | | std::cout<<"per->f_id="<<per->f_id<<std::endl;
|
| | | }
|
| | | }
|
| | | }else
|
| | | std::cout<<"result is null?"<<std::endl;
|
| | | }
|
| | | else
|
| | | {
|