Fixed send information about package and added SQL script installer
This commit is contained in:
parent
5f772f4db8
commit
1fb645b003
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 4.8.2, 2020-05-16T01:41:19. -->
|
<!-- Written by QtCreator 4.8.2, 2020-05-19T00:02:05. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
|
@ -74,7 +74,7 @@ void conexion_client(int client){
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}else{
|
}else{
|
||||||
session_manager* session = new session_manager(client);
|
session_manager* session = new session_manager(client);
|
||||||
while(session->validate_pass());
|
while(!session->validate_pass());
|
||||||
session->start_dialog();
|
session->start_dialog();
|
||||||
delete (session);
|
delete (session);
|
||||||
close(client);
|
close(client);
|
||||||
|
17
installDB.sql
Normal file
17
installDB.sql
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
create database bin_database;
|
||||||
|
use bin_database;
|
||||||
|
|
||||||
|
create table users(
|
||||||
|
id int key not null auto_increment,
|
||||||
|
username varchar(30),
|
||||||
|
passwd varchar(30)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table packages(
|
||||||
|
id int key not null auto_increment,
|
||||||
|
created date default CURRENT_TIME(),
|
||||||
|
name varchar(30),
|
||||||
|
uses bool default false,
|
||||||
|
user int,
|
||||||
|
foreign key (user) references users(id)
|
||||||
|
);
|
@ -20,19 +20,24 @@ std::string msql_acces::get_passwd(std::string username){
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::list<std::string> msql_acces::get_pinfo(){
|
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();
|
sql::ResultSet *res = pstmt->executeQuery();
|
||||||
std::list<std::string> ret;
|
std::list<std::string> ret;
|
||||||
std::string aux;
|
std::string aux;
|
||||||
while(res->next()){
|
while(res->next()){
|
||||||
aux="";
|
aux="";
|
||||||
aux += res->getString("name");
|
aux += res->getString(1);
|
||||||
if(res->getBoolean("uses")){
|
aux += ":"+res->getString(2);
|
||||||
aux+=":true";
|
if(res->getBoolean(3)){
|
||||||
|
aux+=":t";
|
||||||
}else{
|
}else{
|
||||||
aux+=":false";
|
aux+=":f";
|
||||||
}
|
}
|
||||||
aux += ":"+res->getString("created");
|
aux += ":"+res->getString(4);
|
||||||
|
ret.push_back(aux);
|
||||||
}
|
}
|
||||||
delete res;
|
delete res;
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -116,7 +116,7 @@ void session_manager::send_information(){
|
|||||||
for(std::string info : lis){
|
for(std::string info : lis){
|
||||||
this->write_data(info);
|
this->write_data(info);
|
||||||
}
|
}
|
||||||
this->write_data("end:of:the:info");
|
this->write_data("end:info");
|
||||||
}
|
}
|
||||||
|
|
||||||
int session_manager::read_data(char* input, int size){
|
int session_manager::read_data(char* input, int size){
|
||||||
|
Loading…
Reference in New Issue
Block a user