I'm trying to dump a file from sqlite3 database using C++ function. I have tried this on terminal command and it works perfectly but here it's not executed.
errmsg=: no such function: writefile
bool Database::download(string username, string filename){
string query = "SELECT USERNAME FROM FILES WHERE USERNAME='"+username+"';";
int rc = sqlite3_exec(dbFile,query.c_str(),private_callback,(void *)data,&errmsg);
if(rc==SQLITE_OK){
cout<<"this username dont have any uploaded files!"<<endl;
return false;
}
else{
query = "SELECT writefile('"+filename+"',FILE) FROM FILES WHERE USERNAME='"+username+"' AND FILENAME='"+filename+"';";
rc = sqlite3_exec(dbFile,query.c_str(),private_callback,(void *)data,&errmsg);
if(rc!=SQLITE_OK){
cout<<errmsg<<endl;
return false;
}
elsereturn true;
}
}