1 #include <DatabaseUtils/Hardware/Installation.h> 14 t->
CreateFromDB(
"public",
"hardware_position",
"ifdbprod.fnal.gov",
15 "nova_hardware",
"5432",
"nova_reader");
33 std::string vld =
"install_date < '" + ts +
"' and (remove_date is NULL or remove_date > '" + ts +
"')";
36 if (t->
NRow() != 1)
return false;
38 bool ok = r->
Col(
"hw_id")->
Get(
id);
47 std::vector<std::string>& dcmName,
48 std::vector<int>& dcmPort,
55 std::string vld =
"install_date < '" + ts +
"' and (remove_date is NULL or remove_date > '" + ts +
"')";
58 if (t->
NRow() == 0)
return false;
65 for (
int i=0;
i<t->
NRow(); ++
i) {
67 ok &= r->
Col(
"hw_id")->
Get(
id);
68 ok &= r->
Col(
"dcm_name")->
Get(dName);
69 ok &= r->
Col(
"dcm_port")->
Get(dPort);
71 dcmName.push_back(dName);
72 dcmPort.push_back(dPort);
92 std::string vld =
"install_date < '" + ts +
"' and (remove_date is NULL or remove_date > '" + ts +
"')";
95 if (t->
NRow() != 1)
return false;
97 bool ok = r->
Col(
"hw_id")->
Get(
id);
106 std::vector<std::string>& dcmName,
107 std::vector<int>& dcmPort,
114 std::string vld =
"install_date < '" + ts +
"' and (remove_date is NULL or remove_date > '" + ts +
"')";
117 if (t->
NRow() == 0)
return false;
124 for (
int i=0;
i<t->
NRow(); ++
i) {
126 ok &= r->
Col(
"hw_id")->
Get(
id);
127 ok &= r->
Col(
"dcm_name")->
Get(dName);
128 ok &= r->
Col(
"dcm_port")->
Get(dPort);
130 dcmName.push_back(dName);
131 dcmPort.push_back(dPort);
::xsd::cxx::tree::id< char, ncname > id
static std::string GetName(int id)
static nova::database::Table * PositionTable(int detid)
static bool GetAllInstalled(int detid, std::vector< std::string > &dcmName, std::vector< int > &dcmPort, std::vector< std::string > &id, std::string ts="now")
static bool Installed(int detid, std::string dcmName, int dcmPort, std::string &id, std::string ts="now")
bool CreateFromDB(const char *schemaName, const char *tableName, const char *dbhost=0, const char *dbname=0, const char *dbport=0, const char *dbuser=0)
bool SetValidityRange(std::string cname, T start, T end)
static bool Installed(int detid, std::string dcmName, int dcmPort, std::string &id, std::string ts="now")
void SetValiditySQL(std::string cmd)
static bool GetAllInstalled(int detid, std::vector< std::string > &dcmName, std::vector< int > &dcmPort, std::vector< std::string > &id, std::string ts="now")
Prototype Near Detector on the surface at FNAL.
void SetIgnoreEnvVar(bool f)