add read users list

This commit is contained in:
2020-05-20 00:10:05 +02:00
parent 1fb645b003
commit 0b1bb18f83
7 changed files with 59 additions and 2 deletions

View File

@@ -43,6 +43,27 @@ std::list<std::string> msql_acces::get_pinfo(){
return ret;
}
std::list<std::string> msql_acces::get_uinfo(){
sql::PreparedStatement *pstmt =
con->prepareStatement("select username,admin from users");
sql::ResultSet *res = pstmt->executeQuery();
std::list<std::string> ret;
std::string aux;
while(res->next()){
aux="";
aux += res->getString(1);
//aux += ":"+res->getString(2);
if(res->getBoolean(2)){
aux+=":t";
}else{
aux+=":f";
}
ret.push_back(aux);
}
delete res;
return ret;
}
void msql_acces::write_install(std::string package, std::string user){
sql::PreparedStatement *pstmt =
con->prepareStatement("insert into packages(name,user) values(?,(select id from users where username=?))");