Fixed send information about package and added SQL script installer

This commit is contained in:
2020-05-19 20:36:56 +02:00
parent 5f772f4db8
commit 1fb645b003
5 changed files with 31 additions and 9 deletions

View File

@@ -20,19 +20,24 @@ std::string msql_acces::get_passwd(std::string username){
}
std::list<std::string> msql_acces::get_pinfo(){
sql::PreparedStatement *pstmt = con->prepareStatement("select * from packages");
sql::PreparedStatement *pstmt =
con->prepareStatement("select packages.name, packages.created, packages.uses, users.username "
"from packages "
"join users on users.id=packages.user ");
sql::ResultSet *res = pstmt->executeQuery();
std::list<std::string> ret;
std::string aux;
while(res->next()){
aux="";
aux += res->getString("name");
if(res->getBoolean("uses")){
aux+=":true";
aux += res->getString(1);
aux += ":"+res->getString(2);
if(res->getBoolean(3)){
aux+=":t";
}else{
aux+=":false";
aux+=":f";
}
aux += ":"+res->getString("created");
aux += ":"+res->getString(4);
ret.push_back(aux);
}
delete res;
return ret;