9#include "calibUtil/Metadata.h"
10#include "facilities/Util.h"
11#include "facilities/Timestamp.h"
12#include "rdbModel/Management/Manager.h"
13#include "rdbModel/Management/XercesBuilder.h"
14#include "GaudiKernel/Bootstrap.h"
15#include "GaudiKernel/ISvcLocator.h"
19#include "rdbModel/Db/MysqlConnection.h"
20#include "rdbModel/Db/MysqlResults.h"
21#include "rdbModel/Rdb.h"
22#include "rdbModel/RdbException.h"
23#include "rdbModel/Tables/Assertion.h"
24#include "rdbModel/Tables/Table.h"
25#include "rdbModel/Tables/Column.h"
40 const std::string& dbName)
41 : m_readCxt(0), m_writeCxt(0),
42 m_host(host), m_table(table), m_dbName(dbName), m_man(0), m_rdb(0),
44 if (table.compare(
"*") == 0) m_table = std::string(
"$(MYSQL_METATABLE)");
45 if (host.compare(
"*") == 0) m_host = std::string(
"$(MYSQL_HOST)");
49 if (nsub < 0) m_table = std::string(
"metadata");
50 StatusCode sc=Gaudi::svcLocator()->service(
"DatabaseSvc", m_dbsvc,
true);
51 if ( !sc.isSuccess() ) {
52 std::cout <<
"Metadata ERROR ::Could not retrieve the DataBaseSvc" << std::endl;;
60 if (m_man)
delete m_man;
69 user = std::string(
"$(USER)");
71 user = std::string(
"$(USERNAME)");
79 user = std::string(
"");
86 const std::string& user,
87 const std::string& pw, eRet& err,
88 const std::string& dbName) {
96 bool connected = cxt->
open(host, user, pw, dbName);
108 if (m_readCxt == 0) {
113 bool ok = connect(m_readCxt, m_host, std::string(
"guest"),
114 std::string(
"guestpass"), err, m_dbName);
129 bool Metadata::connectWrite(eRet& err) {
130 if (m_writeCxt == 0) {
133 if (m_dbName == std::string(
"calib_test") ) {
134 ok = connect(m_writeCxt, m_host, std::string(
"calib_tester"),
135 std::string(
"udine"), err, m_dbName);
138 ok = connect(m_writeCxt, m_host, std::string(
"calibrator"),
139 std::string(
"calibrator"), err, m_dbName);
146 std::string(
"$(RDBMODELROOT)/xml/")+ m_dbName +
".xml";
147 err = compareSchema(m_writeCxt, schema);
173 const std::string& calibType,
174 const std::string&
SftVer,
175 const std::string& cal_ver,
176 const std::string& cal_par,
177 const std::string& rec_alg,
178 const std::string& rec_par,
179 const std::string& machine,
180 const std::string& flavor) {
187 if (ret !=
RETOk)
return ret;
192 std::vector<Assertion::Operator *> conditions;
193 conditions.reserve(8);
196 FIELDTYPEold, FIELDTYPElit);
199 FIELDTYPEold, FIELDTYPElit);
205 FIELDTYPEold, FIELDTYPElit);
207 FIELDTYPEold, FIELDTYPElit);
209 FIELDTYPEold, FIELDTYPElit);
211 FIELDTYPEold, FIELDTYPElit);
213 FIELDTYPEold, FIELDTYPElit);
215 FIELDTYPEold, FIELDTYPElit);
219 std::cout<<
"run no is::"<<s_run<<std::endl;
222 FIELDTYPEold, FIELDTYPElit);
225 FIELDTYPEold, FIELDTYPElit);
227 conditions.push_back(&completeOp);
228 conditions.push_back(&calibTypeOp);
230 conditions.push_back(&sftverOp);
231 conditions.push_back(&calverOp);
232 conditions.push_back(&calparOp);
233 conditions.push_back(&recalgOp);
234 conditions.push_back(&recparOp);
235 conditions.push_back(&machineOp);
236 conditions.push_back(&runfrmOp);
237 conditions.push_back(&runtoOp);
238 ret = doSelect(conditions, orderBy, ser);
244 const std::string& calibType,
245 const std::string&
SftVer,
246 const std::string& cal_ver,
247 const std::string& cal_par,
248 const std::string& rec_alg,
249 const std::string& rec_par,
250 const std::string& machine,
251 const std::string& flavor)
259 if (ret !=
RETOk)
return ret;
265 std::vector<Assertion::Operator *> conditions;
266 conditions.reserve(8);
268 FIELDTYPEold, FIELDTYPElit);
272 FIELDTYPEold, FIELDTYPElit);
278 FIELDTYPEold, FIELDTYPElit);
280 FIELDTYPEold, FIELDTYPElit);
282 FIELDTYPEold, FIELDTYPElit);
284 FIELDTYPEold, FIELDTYPElit);
286 FIELDTYPEold, FIELDTYPElit);
288 FIELDTYPEold, FIELDTYPElit);
293 FIELDTYPEold, FIELDTYPElit);
296 FIELDTYPEold, FIELDTYPElit);
298 conditions.push_back(&completeOp);
299 conditions.push_back(&calibTypeOp);
301 conditions.push_back(&sftverOp);
302 conditions.push_back(&calverOp);
303 conditions.push_back(&calparOp);
304 conditions.push_back(&recalgOp);
305 conditions.push_back(&recparOp);
306 conditions.push_back(&machineOp);
307 conditions.push_back(&runfrmOp);
308 conditions.push_back(&runtoOp);
310 return doSelect(conditions, orderBy, ser);
317 std::string& dataFmt,
318 std::string& filename) {
328 colNames[0] =
"data_fmt";
329 colNames[1] =
"data_ident";
330 colNames[2] =
"RunFrom";
331 colNames[3] =
"RunTo";
333 std::string serNoVal;
337 FIELDTYPEold, FIELDTYPElit);
347 results = m_readCxt->
select(m_table, colNames, orderBy, &whereClause);
358 std::vector<std::string> fields;
359 std::cout<<
"test id \\"<<std::endl;
362 filename = fields[1];
363 std::string runfrm,runto;
372 if ((dataFmt ==
"") || (filename ==
""))
return RETBadValue;
379 std::string& calParVer,
382 std::string& sftver) {
387 if(sftver==
"default")
388 sftver = getenv(
"BES_RELEASE");
389 const char*
SftVer = sftver.c_str();
391 if(calParVer!=
"default"){
392 const char* calpar = calParVer.c_str();
393 sprintf(stmt1,
"select BarTofPar,EndTofPar,TofConPar,BarTof,EtfTofPar,EtfTofBunch,RunFrom,RunTo,CalParVer,FileName,Status,SftVer from TofCalConst where SftVer = '%s' and RunFrom <= %d and RunTo >= %d and CalParVer = %s",
SftVer,run_No,run_No,calpar);
395 if(calParVer==
"default"){
396 sprintf(stmt1,
"select BarTofPar,EndTofPar,TofConPar,BarTof,EtfTofPar,EtfTofBunch,RunFrom,RunTo,CalParVer,FileName,Status,SftVer from TofCalConst where SftVer = '%s' and RunFrom <= %d and RunTo >= %d order by CalParVer desc",
SftVer,run_No,run_No);
399 int row_no = m_dbsvc->
query(
"offlinedb", stmt1, res);
401 std::cout<<
"ERROR:error searching TOF calibration Data in the database with: "<<stmt1<<std::endl;
411 std::string& calParVer,
414 std::string& sftver) {
420 if(sftver==
"default")
421 sftver = getenv(
"BES_RELEASE");
422 const char*
SftVer = sftver.c_str();
424 if(calParVer!=
"default"){
425 const char* calpar = calParVer.c_str();
426 sprintf(stmt1,
"select LayTree,BoxTree,StrTree,ResTree,ClsTree,RunFrom,RunTo,CalParVer,FileName,Status,SftVer from MucCalConst where SftVer = '%s' and RunFrom <= %d and RunTo >= %d order by CalParVer desc",
SftVer,run_No,run_No);
429 if(calParVer==
"default"){
431 sprintf(stmt1,
"select LayTree,BoxTree,StrTree,ResTree,ClsTree,RunFrom,RunTo,CalParVer,FileName,Status,SftVer from MucCalConst where SftVer = '%s' and RunFrom <= %d and RunTo >= %d order by CalParVer desc",
SftVer,run_No,run_No);
435 int row_no = m_dbsvc->
query(
"offlinedb", stmt1, res);
437 std::cout<<
"ERROR:error searching MUC calibration Data in the database with: "<<stmt1<<std::endl;
448 std::string& calParVer,
451 std::string& sftver) {
457 if(sftver==
"default")
458 sftver = getenv(
"BES_RELEASE");
459 const char*
SftVer = sftver.c_str();
462 if(calParVer!=
"default"){
463 const char* calpar = calParVer.c_str();
464 sprintf(stmt1,
"select NewXtTrees,XtTree,QtTree,T0Tree,SdTree,R2tTrees,RunFrom,RunTo,CalParVer,FileName,Status,SftVer from MdcCalConst where SftVer = '%s' and RunFrom <= %d and RunTo >= %d and CalParVer = '%s'",
SftVer,run_No,run_No,calpar);}
466 if(calParVer==
"default"){
468 sprintf(stmt1,
"select NewXtTrees,XtTree,QtTree,T0Tree,SdTree,R2tTrees,RunFrom,RunTo,CalParVer,FileName,Status,SftVer from MdcCalConst where SftVer = '%s' and RunFrom <= %d and RunTo >= %d order by CalParVer desc",
SftVer,run_No,run_No);}
470 int row_no = m_dbsvc->
query(
"offlinedb", stmt1, res);
472 std::cout<<
"ERROR:error searching Mdc calibration Data in the database with: "<<stmt1<<std::endl;
485 std::string& calParVer,
488 std::string& sftver) {
493 if(sftver==
"default")
494 sftver = getenv(
"BES_RELEASE");
495 const char*
SftVer = sftver.c_str();
497 if(calParVer!=
"default"){
498 const char* calpar = calParVer.c_str();
499 sprintf(stmt1,
"select DigiCalibConst,RunFrom,RunTo,CalParVer,FileName,Status,SftVer from EmcCalConst where SftVer = '%s' and RunFrom <= %d and RunTo >= %d and CalParVer = %s",
SftVer,run_No,run_No,calpar);
502 if(calParVer==
"default"){
504 sprintf(stmt1,
"select DigiCalibConst,RunFrom,RunTo,CalParVer,FileName,Status,SftVer from EmcCalConst where SftVer = '%s' and RunFrom <= %d and RunTo >= %d order by CalParVer desc",
SftVer,run_No,run_No);
507 int row_no = m_dbsvc->
query(
"offlinedb", stmt1, res);
509 std::cout<<
"ERROR:error searching EMC calibration Data in the database with: "<<stmt1<<std::endl;
519 std::string& calParVer,
522 std::string& sftver) {
527 if(sftver==
"default")
528 sftver = getenv(
"BES_RELEASE");
529 const char*
SftVer = sftver.c_str();
531 if(calParVer!=
"default"){
532 const char* calpar = calParVer.c_str();
533 sprintf(stmt1,
"select DriftDist,EntranceAng,MeanGain,GasGain,LayerGain,Resolution,WireGain,ZDep,RunGain,RunFrom,RunTo,CalParVer,FileName,Status,SftVer from DedxCalConst where SftVer = '%s' and RunFrom <= %d and RunTo >= %d and CalParVer = %s",
SftVer,run_No,run_No,calpar);
536 if(calParVer==
"default"){
538 sprintf(stmt1,
"select DriftDist,EntranceAng,MeanGain,GasGain,LayerGain,Resolution,WireGain,ZDep,RunGain,RunFrom,RunTo,CalParVer,FileName,Status,SftVer from DedxCalConst where SftVer = '%s' and RunFrom <= %d and RunTo >= %d order by CalParVer desc",
SftVer,run_No,run_No);
541 int row_no = m_dbsvc->
query(
"offlinedb", stmt1, res);
543 std::cout<<
"ERROR:error searching Dedx calibration Data in the database with: "<<stmt1<<std::endl;
553 std::string& calParVer,
556 std::string& sftver) {
561 if(sftver==
"default")
562 sftver = getenv(
"BES_RELEASE");
563 const char*
SftVer = sftver.c_str();
565 if(calParVer!=
"default"){
566 const char* calpar = calParVer.c_str();
567 sprintf(stmt1,
"select EsTimeH2,EsTimeH9,RunFrom,RunTo,CalParVer,FileName,Status,SftVer from EsTimeCalConst where SftVer = '%s' and RunFrom <= %d and RunTo >= %d and CalParVer = %s",
SftVer,run_No,run_No,calpar);
570 if(calParVer==
"default"){
571 sprintf(stmt1,
"select EsTimeH2,EsTimeH9,RunFrom,RunTo,CalParVer,FileName,Status,SftVer from EsTimeCalConst where SftVer = '%s' and RunFrom <= %d and RunTo >= %d order by CalParVer desc",
SftVer,run_No,run_No);
573 int row_no = m_dbsvc->
query(
"offlinedb", stmt1, res);
575 std::cout<<
"ERROR:error searching EsTime calibration Data in the database with: "<<stmt1<<std::endl;
587 std::string& calParVer,
590 std::string& sftver) {
595 if(sftver==
"default")
596 sftver = getenv(
"BES_RELEASE");
597 const char*
SftVer = sftver.c_str();
599 if(calParVer!=
"default"){
600 const char* calpar = calParVer.c_str();
601 sprintf(stmt1,
"select BarTofPar,EndTofPar,TofConPar,BarTof,EtfTofPar,RunFrom,RunTo,CalParVer,FileName,Status,SftVer from EstTofCalConst where SftVer = '%s' and RunFrom <= %d and RunTo >= %d and CalParVer = %s",
SftVer,run_No,run_No,calpar);
603 if(calParVer==
"default"){
605 sprintf(stmt1,
"select BarTofPar,EndTofPar,TofConPar,BarTof,EtfTofPar,RunFrom,RunTo,CalParVer,FileName,Status,SftVer from EstTofCalConst where SftVer = '%s' and RunFrom <= %d and RunTo >= %d order by CalParVer desc",
SftVer,run_No,run_No);
608 int row_no = m_dbsvc->
query(
"offlinedb", stmt1, res);
610 std::cout<<
"ERROR:error searching EstTOF calibration Data in the database with: "<<stmt1<<std::endl;
620 std::string& calParVer,
623 std::string& sftver) {
628 if(sftver==
"default")
629 sftver = getenv(
"BES_RELEASE");
630 const char*
SftVer = sftver.c_str();
632 if(calParVer!=
"default"){
633 const char* calpar = calParVer.c_str();
634 sprintf(stmt1,
"select BTofSim,ETofSim,SimConstants,RunFrom,RunTo,TofSimParVer,FileName,Status,SftVer from TofSimSvc where SftVer = '%s' and RunFrom <= %d and RunTo >= %d and TofSimParVer = %s",
SftVer,run_No,run_No,calpar);
636 if(calParVer==
"default"){
638 sprintf(stmt1,
"select BTofSim,ETofSim,SimConstants,RunFrom,RunTo,TofSimParVer,FileName,Status,SftVer from TofSimSvc where SftVer = '%s' and RunFrom <= %d and RunTo >= %d order by TofSimParVer desc",
SftVer,run_No,run_No);
642 int row_no = m_dbsvc->
query(
"offlinedb", stmt1, res);
644 std::cout<<
"ERROR:error searching TOFSim calibration Data in the database with: "<<stmt1<<std::endl;
655 std::string& calParVer,
658 std::string& sftver) {
663 if(sftver==
"default")
664 sftver = getenv(
"BES_RELEASE");
665 const char*
SftVer = sftver.c_str();
667 if(calParVer!=
"default"){
668 const char* calpar = calParVer.c_str();
669 sprintf(stmt1,
"select TH1F_Col,bin,RunFrom,RunTo,CalParVer,FileName,Status,SftVer from DedxSim where SftVer = '%s' and RunFrom <= %d and RunTo >= %d and CalParVer = %s",
SftVer,run_No,run_No,calpar);
671 if(calParVer==
"default"){
672 sprintf(stmt1,
"select TH1F_Col,bin,RunFrom,RunTo,CalParVer,FileName,Status,SftVer from DedxSim where SftVer = '%s' and RunFrom <= %d and RunTo >= %d order by CalParVer desc",
SftVer,run_No,run_No);
675 int row_no = m_dbsvc->
query(
"offlinedb", stmt1, res);
677 std::cout<<
"ERROR:error searching DedxSim calibration Data in the database with: "<<stmt1<<std::endl;
688 std::string& calParVer,
691 std::string& sftver) {
696 if(sftver==
"default")
697 sftver = getenv(
"BES_RELEASE");
698 const char*
SftVer = sftver.c_str();
700 if(calParVer!=
"default"){
701 const char* calpar = calParVer.c_str();
702 sprintf(stmt1,
"select AlignEndPlate,WirePos,WireTension,RunFrom,RunTo,MdcAlignVer,AlignEPFileName,Status,SftVer from MdcAlignment where SftVer = '%s' and RunFrom <= %d and RunTo >= %d and MdcAlignVer = %s",
SftVer,run_No,run_No,calpar);
704 if(calParVer==
"default"){
706 sprintf(stmt1,
"select AlignEndPlate,WirePos,WireTension,RunFrom,RunTo,MdcAlignVer,AlignEPFileName,Status,SftVer from MdcAlignment where SftVer = '%s' and RunFrom <= %d and RunTo >= %d order by MdcAlignVer desc",
SftVer,run_No,run_No);
709 int row_no = m_dbsvc->
query(
"offlinedb", stmt1, res);
711 std::cout<<
"ERROR:error searching MdcAlignment calibration Data in the database with: "<<stmt1<<std::endl;
721 std::string& calParVer,
724 std::string& sftver) {
729 if(sftver==
"default")
730 sftver = getenv(
"BES_RELEASE");
731 const char*
SftVer = sftver.c_str();
733 if(calParVer!=
"default"){
734 const char* calpar = calParVer.c_str();
735 sprintf(stmt1,
"select WireEff,RunFrom,RunTo,CalParVer,FileName,Status,SftVer from MdcDataConst where SftVer = '%s' and RunFrom <= %d and RunTo >= %d and CalParVer = %s",
SftVer,run_No,run_No,calpar);
737 if(calParVer==
"default"){
738 sprintf(stmt1,
"select WireEff,RunFrom,RunTo,CalParVer,FileName,Status,SftVer from MdcDataConst where SftVer = '%s' and RunFrom <= %d and RunTo >= %d order by CalParVer desc",
SftVer,run_No,run_No);
741 int row_no = m_dbsvc->
query(
"offlinedb", stmt1, res);
743 std::cout<<
"ERROR:error searching MdcDataConst Data in the database with: "<<stmt1<<std::endl;
753 std::string& calParVer,
756 std::string& sftver) {
761 if(sftver==
"default")
762 sftver = getenv(
"BES_RELEASE");
763 const char*
SftVer = sftver.c_str();
765 if(calParVer!=
"default"){
766 const char* calpar = calParVer.c_str();
767 sprintf(stmt1,
"select BarBoardNum,EndBoardNum,QELecBarParEast,QELecBarParWest,QELecEndPar,SimQELecBarParEast,SimQELecBarParWest,SimQELecEndPar,RunFrom,RunTo,CalParVer,FileName,Status,SftVer from TofQELec where SftVer = '%s' and RunFrom <= %d and RunTo >= %d and CalParVer = %s",
SftVer,run_No,run_No,calpar);
769 if(calParVer==
"default"){
770 sprintf(stmt1,
"select BarBoardNum,EndBoardNum,QELecBarParEast,QELecBarParWest,QELecEndPar,SimQELecBarParEast,SimQELecBarParWest,SimQELecEndPar,RunFrom,RunTo,CalParVer,FileName,Status,SftVer from TofQELec where SftVer = '%s' and RunFrom <= %d and RunTo >= %d order by CalParVer desc",
SftVer,run_No,run_No);
772 int row_no = m_dbsvc->
query(
"offlinedb", stmt1, res);
774 std::cout<<
"ERROR:error searching TofQElec calibration Data in the database with: "<<stmt1<<std::endl;
777 std::cout<<
"metadata ok"<<std::endl;
810Metadata::doSelect(std::vector<rdbModel::Assertion::Operator *>& conditions,
817 colNames[0] =
"ser_no";
832 results = m_readCxt->
select(m_table, colNames, orderBy, &whereClause);
840 std::cout<<
"no results"<<std::endl;
846 std::cout<<
"There are results"<<std::endl;
849 conditions.pop_back();
850 std::cout<<
"no results"<<std::endl;
853 std::vector<std::string> fields;
866 const std::string& flavor,
867 const std::string& calib_type,
868 const std::string& data_ident,
869 const std::string& data_fmt,
870 unsigned int& runfrm,
872 const std::string& input_desc,
873 const std::string& notes,
874 const std::string& proc_level,
875 const std::string& locale,
876 const std::string& fmt_version,
877 const std::string& completion)
886 if (ret !=
RETOk)
return 0;
894 nullCols.reserve(16);
896 if (inst.size() * calib_type.size() * flavor.size() * data_fmt.size()
897 * data_ident.size() * proc_level.size() * completion.size()
898 * locale.size() == 0) {
901 cols.push_back(
"calib_type"); vals.push_back(calib_type);
903 cols.push_back(
"data_fmt"); vals.push_back(data_fmt);
904 cols.push_back(
"data_ident"); vals.push_back(data_ident);
905 cols.push_back(
"status"); vals.push_back(completion);
906 std::string s_runfrm,s_runto;
909 cols.push_back(
"RunFrom"); vals.push_back(s_runfrm);
910 cols.push_back(
"RunTo"); vals.push_back(s_runto);
913 if (input_desc.size() > 0 ) {
914 cols.push_back(
"input_desc"); vals.push_back(input_desc);
915 }
else nullCols.push_back(
"input_desc");
917 if (notes.size() > 0 ) {
918 cols.push_back(
"notes"); vals.push_back(notes);
919 }
else nullCols.push_back(
"notes");
921 if (fmt_version.size() > 0 )
923 cols.push_back(
"fmt_version");
924 vals.push_back(fmt_version);
928 cols.push_back(
"creator"); vals.push_back(
"Metadata::registerCalib");
931 cols.push_back(
"uid"); vals.push_back(uid);
933 cols.push_back(
"enter_time");vals.push_back(curTime.
getString());
936 cols.push_back(
"update_time");vals.push_back(curTime.
getString());
947 if (!(m_writeCxt->
insertRow(m_table, cols, vals, &ser_no, &nullCols)) ) {
956 const std::string& schema) {
971 int errcode = m_man->
build();
974 std::cerr <<
"Error in database description file " << schema
976 std::cerr <<
"Parse failed with error " << errcode << std::endl;
989 std::cout <<
"XML schema and MySQL database are NOT compatible"
993 std::cout <<
"Connection failed while attempting match" << std::endl;
1001 unsigned nCol = cols.size();
1005 for (
unsigned iCol = 0; iCol < nCol; iCol++) {
1007 if (!col->
okValue(vals[iCol])) {
1008 std::cerr <<
"Value " << vals[iCol] <<
" not allowed for column "
1009 << cols[iCol] <<
" in table " << m_table << std::endl;
1017 unsigned nCol = cols.size();
1021 for (
unsigned iCol = 0; iCol < nCol; iCol++) {
1024 std::cerr <<
"Column "
1025 << cols[iCol] <<
" in table " << m_table
1026 <<
" is not nullable" << std::endl;
1034unsigned Metadata::adjustVend(
int newSer) {
1043 std::string serString;
1046 getCols.push_back(
"flavor");
1047 getCols.push_back(
"calib_type");
1048 getCols.push_back(
"completion");
1055 if (!connectWrite(err))
return 0;
1060 FIELDTYPEold, FIELDTYPElit);
1067 results = m_writeCxt->
select(m_table, getCols, orderBy, where);
1073 std::cout << ex.
getMsg();
1078 std::cout <<
"MySQL failure in SELECT" << std::endl;
1082 std::cout <<
"Look-up of serial# " << serString <<
" failed"
1086 std::vector<std::string> fields;
1088 if (fields[2] !=
"OK")
return 0;
1094 std::vector<Assertion::Operator *> conditions;
1095 conditions.reserve(7);
1096 for (
unsigned ix = 0;
ix < 5;
ix++) {
1099 FIELDTYPEold, FIELDTYPElit));
1104 FIELDTYPEold, FIELDTYPElit));
1108 FIELDTYPEold, FIELDTYPElit));
1116 toUpdate.push_back(
"vend");
1118 newVal.push_back(fields[5]);
1121 toUpdate.push_back(
"update_time");newVal.push_back(curTime.
getString());
1123 unsigned nModified = m_writeCxt->
update(m_table, toUpdate, newVal, where);
std::vector< std::string > StringVector
Simple algorithm to test functioning of "the other" TDS.
virtual int query(const std::string &dbName, const std::string &sql, DatabaseRecordVector &res)=0
std::string getString() const
Return string representation of time, not including nanoseconds;.
static int expandEnvVar(std::string *toExpand, const std::string &openDel=std::string("$("), const std::string &closeDel=std::string(")"))
static int atoi(const std::string &InStr)
converts an std::string to an integer
static int stringToInt(const std::string &InStr)
static const char * itoa(int val, std::string &outStr)
bool nullAllowed() const
Returns true if column may take on value NULL.
bool okValue(const std::string &val, bool set=true) const
virtual ResultHandle * select(const std::string &tableName, const StringVector &getCols, const StringVector &orderCols, const Assertion *where=0, int rowLimit=0, int rowOffset=0)=0
virtual MATCH matchSchema(Rdb *rdb, bool matchDbName=true)=0
virtual unsigned int update(const std::string &tableName, const StringVector &colNames, const StringVector &values, const Assertion *where=0, const StringVector *nullCols=0)=0
virtual bool open(const std::string &host, const std::string &userid, const std::string &password, const std::string &dbName)=0
virtual bool insertRow(const std::string &tableName, const StringVector &colNames, const StringVector &values, int *auto_value=0, const StringVector *nullCols=0)=0
void setInputSource(std::string pname)
void setBuilder(Builder *b)
static Manager * getManager()
virtual std::string getMsg()
Table * getTable(const std::string &name) const
virtual bool getRow(std::vector< std::string > &fields, unsigned int i=0, bool clear=true)=0
virtual unsigned int getNRows() const =0
Return number of rows in results.
Column * getColumnByName(const std::string &name) const
Module implements methods for clients to get generic services.
std::vector< std::string > StringVector