long ConfigurationTable::key2id(const ConfigurationKey& key) { std::list<long> ids = selectids(condition(key)); if (ids.size() != 1) { std::string msg = stringprintf("%s not found", key.toString().c_str()); throw NoSuchEntry(msg); } return *ids.begin(); }
/** * \brief Retrieve calibration ids for a selected guider */ std::list<long> CalibrationTable::selectids( const GuiderDescriptor& guiderdescriptor) { std::string condition = stringprintf( "instrument = '%s' and ccd = '%s' and controldevice = '%s' " "order by whenstarted", guiderdescriptor.instrument().c_str(), guiderdescriptor.ccd().c_str(), guiderdescriptor.guideport().c_str()); debug(LOG_DEBUG, DEBUG_LOG, 0, "condition for calibrations: %s", condition.c_str()); return selectids(condition); }
/** * \brief Retrieve calibration ids for a selected guider */ std::list<long> CalibrationTable::selectids( const GuiderDescriptor& guiderdescriptor) { std::string condition = stringprintf( "camera = '%s' and ccdid = %d and guiderport = '%s' " "order by whenstarted", guiderdescriptor.cameraname().c_str(), guiderdescriptor.ccdid(), guiderdescriptor.guiderportname().c_str()); debug(LOG_DEBUG, DEBUG_LOG, 0, "condition for calibrations: %s", condition.c_str()); return selectids(condition); }
bool PartTable::has(long projectid, long partno) { std::string condition = stringprintf("id = %d and partno = %d", projectid, partno); return selectids(condition).size() > 0; }
std::list<long> ConfigurationTable::list(const std::string& domain, const std::string& section) { return selectids(condition(domain, section)); }
std::list<long> ConfigurationTable::list() { return selectids("0 = 0"); }