photo* db::getImage(int imageId){ QSqlQuery query(database); query.prepare("SELECT DISTINCT Fid,Pid FROM HasFaces WHERE Iid = :imageId "); query.bindValue(":imageId", imageId); bool k=query.exec(); QList<face*>* fl = new QList<face*>(); QString imagePath = getImagePath(imageId); string path = QStringToString(imagePath); while(query.next()){ int faceId = query.value(0).toInt(); int personId = query.value(1).toInt(); face* f = getFace(faceId); f->setLabel(QStringToString(getPersonName(personId))); f->setPhotoID(imageId); f->setPath(path); fl->append(f); } photo* p = new photo(imagePath,fl); p->setID(imageId); return p; }
int main(int argc, char* argv[]) { char* name = getPersonName(1); printf("Name: %s\n", name); exit(0); }