Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • bias/observers/mysql-observer
1 result
Show changes
Commits on Source (1)
......@@ -26,6 +26,7 @@ MysqlObserverBuilder::MysqlObserverBuilder(inaf::oasbo::DAQ::BaseDAQ *dataAcquis
this->reset();
}
MysqlObserverBuilder::MysqlObserverBuilder(inaf::oasbo::DAQ::BaseDAQ *dataAcquisition, std::string ip, int port, std::string username, std::string password, std::string dbname) {
this->daq = dataAcquisition;
this->observer = new MysqlObserver(dataAcquisition,ip, port, username, password, dbname);
}
MysqlObserverBuilder::~MysqlObserverBuilder() {
......
......@@ -44,14 +44,17 @@ const std::string MysqlObserver::SCHED_BLOCK_TABLE =
const std::string MysqlObserver::ACTIVE_FIELD = "active";
MysqlObserver::MysqlObserver(inaf::oasbo::DAQ::BaseDAQ *daq,
std::string ip, int port, std::string user, std::string password,
std::string ip, int port, std::string username, std::string password,
std::string dbname) :
inaf::oasbo::DAQ_Observers::BaseDAQ_Observer(daq) {
this->ip = ip;
this->port = port;
this->username = username;
this->password = password;
this->dbname = dbname;
try {
driver = sql::mysql::get_mysql_driver_instance();
con = driver->connect("tcp://" + ip + ":" + std::to_string(port), user,
con = driver->connect("tcp://" + ip + ":" + std::to_string(port), username,
password);
con->setSchema(dbname);
} catch (sql::SQLException &e) {
......@@ -62,6 +65,10 @@ MysqlObserver::MysqlObserver(inaf::oasbo::DAQ::BaseDAQ *daq,
this->file_is_open = false;
}
MysqlObserver::MysqlObserver(inaf::oasbo::DAQ::BaseDAQ *daq) :
MysqlObserver(daq,"127.0.0.1",3306,"bias","BIAS1ast01$1","BIAS"){
}
MysqlObserver::~MysqlObserver() {
if (stmt != nullptr)
delete stmt;
......