I have a struct to store retrieved data before i put them into a vector.
typedef struct{
long long int uuId;
short int gender;
short int age;
short int cameraNo;
unsigned char *image; //[IMAGE_SIZE];
size_t imageSize;
//std::string time;
}FaceRecord;
How can i get blob data and put it to a char* or char[]? tempFR is a temporary struct to push_back into the vector. Here is a part of my function:
std::stringstream s;
s << "SELECT * FROM Dao WHERE gender = "<< data <<"";
prepStmt = con->prepareStatement (s.str());
res = prepStmt->executeQuery();
unsigned char* ptr;
size_t blobSize=100;
std::istream *is;
while(res->next()){
tempFR.uuId = res->getInt64("uuId");
tempFR.cameraNo = res->getInt("cameraNo");
tempFR.age = res->getInt("age");
tempFR.gender = res->getInt("gender");
is = res->getBlob("image");
is->seekg (0, std::ios::end);
blobSize = is->tellg();
is->seekg (0, std::ios::beg);
tempFR.image = new unsigned char[blobSize];
is->read((char*)tempFR.image,blobSize);
tempFR.imageSize = blobSize;
rec->push_back(tempFR);
}