Commit 13db4dba authored by Giacomo Strangolino's avatar Giacomo Strangolino
Browse files

fixed database queries. conf for taeyang

parent d1077863
# database for service and activity records
ca-supervisor:dbuser=www-data
ca-supervisor:dbpass=cadbdb
ca-supervisor:dbhost=localhost
ca-supervisor:dbnam=cadb
dbuser=www-data
dbpass=cadbdb
dbhost=localhost
dbnam=cadb
# bind to
ca-supervisor:host=192.168.205.25
ca-supervisor:port=9295
host=taeyang.elettra.eu
port=9295
......@@ -92,7 +92,7 @@ void CaSupervisor::onResult(const std::vector<CuData> &srcs) {
// jsonize: chdmap will hold client id->CuData map useful for later error reporting
const std::map<std::string, std::string> &jsonma = jiz.jsonize(srcs, clidmap);
if(jsonma.size() > 0)
d->log->write("ca-supervisor", "requests grouped by *channel*", CuLog::LevelInfo);
d->log->write("ca-supervisor", "requests grouped by *client ID*", CuLog::LevelInfo);
for(const auto &[k, v] : jsonma) {
d->log->write("ca-supervisor", k + " --> " + v, CuLog::LevelInfo);
}
......
......@@ -64,13 +64,15 @@ std::vector<CuData> CaSupDbFuncs::get_active_services(CaDbH *dbh) {
// return sources (=activities) for the given service id
// sources client id must be valid (i.e. in the register table)
std::vector<CuData>* CaSupDbFuncs::get_srcs_for_srv_id(CaDbH *h, int id) {
std::string stm = "SELECT activity.source,activity.chan,service.conf_id,activity.cli_id "
const std::string &stm = "SELECT activity.source,activity.chan,service.conf_id,activity.cli_id "
"FROM activity,service,register "
"WHERE service.id=activity.srv_id AND service.id=$1 AND activity.cli_id "
"IN (SELECT client_id FROM register)";
"WHERE service.id=activity.srv_id AND service.id=$1 "
"AND activity.cli_id=register.client_id";
CaDbRes res = h->execute(stm, std::vector<std::string> { std::to_string(id) });
std::vector<CuData> *v = new std::vector<CuData>();
*v = m_res_to_data(res);
printf( "CaSupDbFuncs::get_srcs_for_srv_id query with id %d returned %ld datas res size %ld\n",
id, v->size(), res.size());
last_db_error = res.errmsg;
return v;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment