43 cm_msg(
MINFO,
"hs_get_history",
"History channel \'IMAGE\' handled by image facility");
48 size =
sizeof(active);
61 printf(
"hs_get_history: see channel hkey %d, name \'%s\', active %d, type [%s], debug %d\n",
hKey,
key.
name, active,
type.c_str(),
debug);
77 cm_msg(
MERROR,
"hs_get_history",
"mlogger ODB setting /Logger/WriteFileHistory is obsolete, please delete it. Use /Logger/History/MIDAS/Active instead");
86 (*mh)->hs_set_debug(
debug);
88 status = (*mh)->hs_connect(path.c_str());
90 cm_msg(
MERROR,
"hs_get_history",
"Cannot connect to MIDAS history, status %d",
status);
95 cm_msg(
MINFO,
"hs_get_history",
"Connected history channel \'%s\' type MIDAS history in \"%s\"",
key.
name, path.c_str());
107 cm_msg(
MERROR,
"hs_get_history",
"mlogger ODB setting /Logger/ODBC_Debug is obsolete, please delete it. Use /Logger/History/ODBC/Debug instead");
112 cm_msg(
MERROR,
"hs_get_history",
"mhttpd ODB setting /History/ODBC_Debug is obsolete, please delete it. Use /Logger/History/ODBC/Debug instead");
119 cm_msg(
MERROR,
"hs_get_history",
"mlogger ODB setting /Logger/ODBC_DSN is obsolete, please delete it. Use /Logger/History/ODBC/Writer_ODBC_DSN instead");
124 cm_msg(
MERROR,
"hs_get_history",
"mhttpd ODB setting /History/ODBC_DSN is obsolete, please delete it. Use /Logger/History/ODBC/Reader_ODBC_DSN instead");
147 }
else if (
dsn.length() > 1) {
154 (*mh)->hs_set_debug(
debug);
158 cm_msg(
MERROR,
"hs_get_history",
"Cannot connect to ODBC SQL driver \'%s\', status %d. Check .odbc.ini and MIDAS documentation",
dsn.c_str(),
status);
163 cm_msg(
MINFO,
"hs_get_history",
"Connected history channel \'%s\' type ODBC (MySQL), DSN \'%s\'",
key.
name,
dsn.c_str());
178 (*mh)->hs_set_debug(
debug);
180 status = (*mh)->hs_connect(path.c_str());
182 cm_msg(
MERROR,
"hs_get_history",
"Cannot connect to SQLITE history, status %d, see messages",
status);
187 cm_msg(
MINFO,
"hs_get_history",
"Connected history channel \'%s\' type SQLITE in \'%s\'",
key.
name, path.c_str());
204 (*mh)->hs_set_debug(
debug);
206 status = (*mh)->hs_connect(path.c_str());
208 cm_msg(
MERROR,
"hs_get_history",
"Cannot connect to FILE history, status %d, see messages",
status);
213 cm_msg(
MINFO,
"hs_get_history",
"Connected history channel \'%s\' type FILE in \'%s\'",
key.
name, path.c_str());
252 (*mh)->hs_set_debug(
debug);
254 status = (*mh)->hs_connect(path.c_str());
256 cm_msg(
MERROR,
"hs_get_history",
"Cannot connect to MYSQL history, status %d",
status);
261 cm_msg(
MINFO,
"hs_get_history",
"Connected history channel \'%s\' type MYSQL at \'%s\'",
key.
name,
306 (*mh)->hs_set_debug(
debug);
309 status = (*mh)->hs_connect(path.c_str());
311 cm_msg(
MERROR,
"hs_get_history",
"Cannot connect to PGSQL history, status %d",
status);
316 cm_msg(
MINFO,
"hs_get_history",
"Connected history channel \'%s\' type PGSQL at \'%s\'",
key.
name,
321 cm_msg(
MINFO,
"hs_get_history",
"History channel \'IMAGE\' handled by image facility");
323 cm_msg(
MERROR,
"hs_get_history",
"Logger history channel /Logger/History/%s/Type has invalid value \'%s\', valid values are MIDAS, ODBC, SQLITE, MYSQL, FILE and IMAGE",
key.
name,
type.c_str());
331 mstrlcpy((*mh)->type,
type.c_str(),
sizeof((*mh)->type));
349 cm_msg(
MERROR,
"hs_find_reader_channel",
"Cannot find /Logger/History, db_find_key() status %d",
status);
361 cm_msg(
MERROR,
"hs_find_reader_channel",
"Misconfigured history: history channel name in /History/LoggerHistoryChannel is \'%s\', not present in /Logger/History, db_find_key() status %d",
hschanname.c_str(),
status);
377 size =
sizeof(active);
385 cm_msg(
MERROR,
"hs_find_reader_channel",
"Cannot find default history: /History/LoggerHistoryChannel is empty and there are no active history channels in /Logger/History");
392 return path +
".LOGGER_HISTORY_EVENTS.TXT";
410 const char* s =
ss.c_str();
438 char *s =
fgets(buf,
sizeof(buf),
fp);
std::string cm_get_path()
std::string cm_get_history_path(const char *history_channel)
MidasHistoryInterface * MakeMidasHistory()
INT cm_msg(INT message_type, const char *filename, INT line, const char *routine, const char *format,...)
INT db_get_value(HNDLE hDB, HNDLE hKeyRoot, const char *key_name, void *data, INT *buf_size, DWORD type, BOOL create)
INT db_get_key(HNDLE hDB, HNDLE hKey, KEY *key)
INT EXPRT db_get_value_string(HNDLE hdb, HNDLE hKeyRoot, const char *key_name, int index, std::string *s, BOOL create, int create_string_length)
INT db_find_key(HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
INT db_enum_key(HNDLE hDB, HNDLE hKey, INT idx, HNDLE *subkey_handle)
int hs_read_event_list(std::vector< std::string > *pevents)
int hs_save_event_list(const std::vector< std::string > *pevents)
int hs_find_reader_channel(HNDLE hDB, HNDLE *hKeyOut, int debug_flag)
int hs_get_history(HNDLE hDB, HNDLE hKey, int flags, int debug_flag, MidasHistoryInterface **mh)
static std::string hs_event_list_filename()
MidasHistoryInterface * MakeMidasHistoryODBC()
MidasHistoryInterface * MakeMidasHistorySqlDebug()
MidasHistoryInterface * MakeMidasHistorySqlite()
MidasHistoryInterface * MakeMidasHistoryMysql()
MidasHistoryInterface * MakeMidasHistoryPgsql()
MidasHistoryInterface * MakeMidasHistoryFile()
BOOL debug
debug printouts
#define DIR_SEPARATOR_STR
MidasHistoryInterface * mh
#define write(n, a, f, d)
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)