|
|
|
@ -946,17 +946,22 @@ SESSION_DATA * servaMySQLDBC::getSessionData(uint64_t id) |
|
|
|
{ |
|
|
|
RetVal->track_id = atoi(it->second.c_str()); |
|
|
|
}; |
|
|
|
// it = cArr->find("lts");
|
|
|
|
// if( it != cArr->end() ){
|
|
|
|
// RetVal->lts = atoi( it->second.c_str() );
|
|
|
|
// };
|
|
|
|
RetVal->lts = time(NULL); |
|
|
|
it = cArr->find("uuid"); |
|
|
|
it = cArr->find("lts"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
RetVal->lts = atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
//RetVal->lts = time(NULL); //? Why ?
|
|
|
|
it = cArr->find("uuid"); |
|
|
|
if (it != cArr->end()) |
|
|
|
{ |
|
|
|
strncpy(RetVal->uuid, it->second.c_str(), 64); |
|
|
|
RetVal->uuid[64] = (char) 0; |
|
|
|
}; |
|
|
|
it = cArr->find("final"); |
|
|
|
if (it != cArr->end()) |
|
|
|
{ |
|
|
|
RetVal->final = it->second.c_str()[0]; |
|
|
|
}; |
|
|
|
}; |
|
|
|
}; |
|
|
|
}; |
|
|
|
@ -1139,6 +1144,72 @@ SCADA_TRACK_INFO * servaMySQLDBC::getTrackSCADA(uint64_t id) |
|
|
|
return RetVal; |
|
|
|
} |
|
|
|
|
|
|
|
DBC_IS_TRACK_DATA * servaMySQLDBC::getTrackData(uint64_t id) |
|
|
|
{ |
|
|
|
DBC_IS_TRACK_DATA * RetVal = NULL; |
|
|
|
if (m_bIsConnected) |
|
|
|
{ |
|
|
|
char tQBuf[MAX_PATH_LEN]; |
|
|
|
AAssoc * result; |
|
|
|
sprintf(tQBuf, "SELECT * FROM `metro_tracks` WHERE `id`=%" PRIu64, id); |
|
|
|
#ifdef DEBUG_ALL
|
|
|
|
LOG(tQBuf); |
|
|
|
#endif
|
|
|
|
result = m_pDatabase->Query(tQBuf); |
|
|
|
if (result != NULL) |
|
|
|
{ |
|
|
|
if (result->size() > 0) |
|
|
|
{ |
|
|
|
RetVal = (DBC_IS_TRACK_DATA *) malloc(sizeof(DBC_IS_TRACK_DATA)); |
|
|
|
if (RetVal) |
|
|
|
{ |
|
|
|
memset(RetVal, 0, sizeof(DBC_IS_TRACK_DATA)); |
|
|
|
|
|
|
|
RetVal->id = id; |
|
|
|
|
|
|
|
Assoc * cArr; |
|
|
|
Assoc::iterator it; |
|
|
|
cArr = result->at(0); |
|
|
|
it = cArr->find("platform_id"); |
|
|
|
if (it != cArr->end()) |
|
|
|
{ |
|
|
|
RetVal->platform_id = atoll(it->second.c_str()); |
|
|
|
}; |
|
|
|
it = cArr->find("side"); |
|
|
|
if (it != cArr->end()) |
|
|
|
{ |
|
|
|
RetVal->side = it->second.c_str()[0]; |
|
|
|
}; |
|
|
|
it = cArr->find("far_module_id"); |
|
|
|
if (it != cArr->end()) |
|
|
|
{ |
|
|
|
RetVal->fmid = atoll(it->second.c_str()); |
|
|
|
}; |
|
|
|
it = cArr->find("near_module_id"); |
|
|
|
if (it != cArr->end()) |
|
|
|
{ |
|
|
|
RetVal->nmid = atoll(it->second.c_str()); |
|
|
|
}; |
|
|
|
it = cArr->find("name"); |
|
|
|
if (it != cArr->end()) |
|
|
|
{ |
|
|
|
strncpy(RetVal->name, it->second.c_str(), 64); |
|
|
|
RetVal->name[64] = (char) 0; |
|
|
|
}; |
|
|
|
it = cArr->find("short"); |
|
|
|
if (it != cArr->end()) |
|
|
|
{ |
|
|
|
strncpy(RetVal->short, it->second.c_str(), 32); |
|
|
|
RetVal->short[32] = (char) 0; |
|
|
|
}; |
|
|
|
}; |
|
|
|
}; |
|
|
|
deleteResult(result); |
|
|
|
}; |
|
|
|
}; |
|
|
|
return RetVal; |
|
|
|
} |
|
|
|
|
|
|
|
uint64_t servaMySQLDBC::getTrackIdByMojo(uint64_t id) |
|
|
|
{ |
|
|
|
uint64_t RetVal = 0; |
|
|
|
|