14 std::string bareOwner, extraLabel;
15 GetLabel().GetBareOwnerAndExtraLabel(bareOwner,extraLabel);
16 if (extraLabel==
"") extraLabel=
"None";
24 std::stringstream squery;
28 squery<<
"select ref_channel from jitters where jitter_algo = '" <<bareOwner
29 <<
"' and jitter_version = '"<<GetVersion()
30 <<
"' and jitter_extralabel= '"<<extraLabel
31 <<
"' and channel = "<<GetChannel()
32 <<
" and data_set = "<<GetDataset();
38 catch(
const QError& cerr) {
49 squery<<
"select jitter from jitters where jitter_algo = '" <<bareOwner
50 <<
"' and jitter_version = '"<<GetVersion()
51 <<
"' and jitter_extralabel= '"<<extraLabel
52 <<
"' and channel = "<<GetChannel()
53 <<
" and data_set = "<<GetDataset();
59 catch(
const QError& cerr) {
70 squery<<
"select err_jitter from jitters where jitter_algo = '" <<bareOwner
71 <<
"' and jitter_version = '"<<GetVersion()
72 <<
"' and jitter_extralabel= '"<<extraLabel
73 <<
"' and channel = "<<GetChannel()
74 <<
" and data_set = "<<GetDataset();
80 catch(
const QError& cerr) {
95 std::string calib_algo, calib_version, calib_extralabel;
101 squery<<
"select calib_algo, calib_version, calib_extralabel from "<<bareOwner<<
"_jitter_algo"
102 <<
" where jitter_version= '"<<GetVersion()
103 <<
"' and jitter_extralabel= '"<<extraLabel <<
"'";
106 table = db->
DoQuery(squery.str());
109 catch(
const QError& cerr) {
115 if(table[
"calib_algo"].size() == 1) {
116 calib_algo = table[
"calib_algo"].begin()->GetString();
117 calib_version = table[
"calib_version"].begin()->GetString();
118 calib_extralabel = table[
"calib_extralabel"].begin()->GetString();
121 std::string errMsg(
"The primary key was not found in DB; Check you input.\nFill the object with default values.\nQuery: ");
122 errMsg +=squery.str();
123 err.SetDescription(__FILE__, __LINE__, errMsg);
127 catch(
const QError& cerr) {
134 fCalibLabel = calib_algo +
"_" + calib_extralabel;
135 if(calib_extralabel==
"None") fCalibLabel = calib_algo;
136 fCalibVersion = calib_version;
147 std::string bareOwner, extraLabel;
148 GetLabel().GetBareOwnerAndExtraLabel(bareOwner,extraLabel);
149 if (extraLabel==
"") extraLabel=
"None";
151 std::string calib_algo, calib_version, calib_extralabel;
152 calib_version = GetCalibVersion();
158 if (calib_extralabel==
"") calib_extralabel =
"None";
159 if(calib_algo.empty() && fCalibLabel.find_first_of(
"@") == std::string::npos) calib_algo = fCalibLabel;
161 std::stringstream squery;
166 squery<<
"select calib_algo from "<<bareOwner<<
"_jitter_algo"
167 <<
" where jitter_version = '"<<GetVersion()
168 <<
"' and jitter_extralabel= '"<<extraLabel<<
"'";
175 catch(
const QError& cerr) {
180 squery<<
"INSERT into "<<bareOwner<<
"_jitter_algo (jitter_version, jitter_extralabel, calib_algo, calib_version, calib_extralabel) values "
182 << GetVersion()<<
"','"
185 << calib_version<<
"','"
186 << calib_extralabel<<
"')";
193 catch(
const QError& cerr) {
205 fields.push_back((std::string)
"jitter_algo");
206 fields.push_back((std::string)
"jitter_version");
207 fields.push_back((std::string)
"jitter_extralabel");
208 fields.push_back((std::string)
"channel");
209 fields.push_back((std::string)
"data_set");
210 fields.push_back((std::string)
"ref_channel");
211 fields.push_back((std::string)
"jitter");
212 fields.push_back((std::string)
"err_jitter");
213 values.push_back(
"'"+bareOwner+
"'");
214 values.push_back(
"'"+GetVersion()+
"'");
215 values.push_back(
"'"+extraLabel+
"'");
216 values.push_back(GetChannel());
217 values.push_back(GetDataset());
219 values.push_back(jitter.
fJitter);
224 db->
Insert(
"jitters",fields,values);
226 catch(
const QError& cerr) {
dm Get("DAQ",&rHandle,"DB")
QError DoQuery(const std::string &query, QDbTable &table)
std::map< std::string, column > QDbTable
int DoQueryInt(const std::string &query)
double DoQueryDouble(const std::string &query)
int DoExec(const std::string &Query)
Execute an INSERT, UPDATE, DELETE, FETCH, or MOVE statement.
std::string DoQueryString(const std::string &query)
int Insert(const std::string &tableName, const column &fields, const column &values)
error class with error type and description
Label for global QObject's.
void GetBareOwnerAndExtraLabel(std::string &bOwner, std::string &el) const
split extra label and bare module name
std::string GetStringLabel() const
convert label to string
std::vector< QVdt > QVdt_vector
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...