#include <string>
std::string GetPosNameForTerminalId(int terminalId)
{
// Database query setup
m_query->Close();
m_query->SQL->Text = "SELECT pos_name FROMref_pos_account WHERE REF_POS_ACCOUNT_ID = :REF_POS_ACCOUNT_ID";
m_query->ParamByName("REF_POS_ACCOUNT_ID")->AsInteger = terminalId;
m_query->ExecQuery();
// Retrieve pos_name if exists
std::string posName;
if (!m_query->Eof()) {
posName = m_query->FieldByName("pos_name")->AsString; }
// Close the query
m_query->Close();
return posName;
}
The << terminaId << is coming out from the program itself as integer,dynamically assign the terminalId
to the database query and then check if the associated POS has a specific name.