23{
26 int active;
29
31
36 }
37
40
42 if (debug_flag)
43 cm_msg(
MINFO,
"hs_get_history",
"History channel \'IMAGE\' handled by image facility");
45 }
46
47 active = 0;
48 size = sizeof(active);
51
54
59
60 if (debug_flag)
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);
62
64
66
68
70
72
77 cm_msg(
MERROR,
"hs_get_history",
"mlogger ODB setting /Logger/WriteFileHistory is obsolete, please delete it. Use /Logger/History/MIDAS/Active instead");
79 active = 0;
80 }
81
85
86 (*mh)->hs_set_debug(
debug);
87
88 status = (*mh)->hs_connect(path.c_str());
90 cm_msg(
MERROR,
"hs_get_history",
"Cannot connect to MIDAS history, status %d",
status);
92 }
93
94 if (debug_flag)
95 cm_msg(
MINFO,
"hs_get_history",
"Connected history channel \'%s\' type MIDAS history in \"%s\"",
key.
name, path.c_str());
96 }
97
99
100 if (1) {
102
107 cm_msg(
MERROR,
"hs_get_history",
"mlogger ODB setting /Logger/ODBC_Debug is obsolete, please delete it. Use /Logger/History/ODBC/Debug instead");
108 }
109
112 cm_msg(
MERROR,
"hs_get_history",
"mhttpd ODB setting /History/ODBC_Debug is obsolete, please delete it. Use /Logger/History/ODBC/Debug instead");
113 }
114
116
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");
120 }
121
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");
125 }
126 }
127
130
133
136
138
143
147 }
else if (
dsn.length() > 1) {
149 }
150
153
154 (*mh)->hs_set_debug(
debug);
155
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);
160 }
161
162 if (debug_flag)
163 cm_msg(
MINFO,
"hs_get_history",
"Connected history channel \'%s\' type ODBC (MySQL), DSN \'%s\'",
key.
name,
dsn.c_str());
164 }
166
168
170
172
177
178 (*mh)->hs_set_debug(
debug);
179
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);
184 }
185
186 if (debug_flag)
187 cm_msg(
MINFO,
"hs_get_history",
"Connected history channel \'%s\' type SQLITE in \'%s\'",
key.
name, path.c_str());
188 }
190
192
194
196
197
198
203
204 (*mh)->hs_set_debug(
debug);
205
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);
210 }
211
212 if (debug_flag)
213 cm_msg(
MINFO,
"hs_get_history",
"Connected history channel \'%s\' type FILE in \'%s\'",
key.
name, path.c_str());
214 }
216
219
222
225
227
232
233 std::string path;
234
237 else {
239
241
245 }
246
251
252 (*mh)->hs_set_debug(
debug);
253
254 status = (*mh)->hs_connect(path.c_str());
256 cm_msg(
MERROR,
"hs_get_history",
"Cannot connect to MYSQL history, status %d",
status);
258 }
259
260 if (debug_flag)
261 cm_msg(
MINFO,
"hs_get_history",
"Connected history channel \'%s\' type MYSQL at \'%s\'",
key.
name,
262 path.c_str());
263 }
265
268
271
274
276
281
282 std::string path;
283
286 else {
288
290
294 }
295
300
305
306 (*mh)->hs_set_debug(
debug);
307
308
309 status = (*mh)->hs_connect(path.c_str());
311 cm_msg(
MERROR,
"hs_get_history",
"Cannot connect to PGSQL history, status %d",
status);
313 }
314
315 if (debug_flag)
316 cm_msg(
MINFO,
"hs_get_history",
"Connected history channel \'%s\' type PGSQL at \'%s\'",
key.
name,
317 path.c_str());
318 }
320 if (debug_flag)
321 cm_msg(
MINFO,
"hs_get_history",
"History channel \'IMAGE\' handled by image facility");
322 } else {
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());
325 }
326
329
331 mstrlcpy((*mh)->type,
type.c_str(),
sizeof((*mh)->type));
332
334}
std::string cm_get_path()
std::string cm_get_history_path(const char *history_channel)
MidasHistoryInterface * MakeMidasHistory()
INT db_get_key(HNDLE hDB, HNDLE hKey, KEY *key)
int hs_find_reader_channel(HNDLE hDB, HNDLE *hKeyOut, int debug_flag)
MidasHistoryInterface * MakeMidasHistoryODBC()
MidasHistoryInterface * MakeMidasHistorySqlDebug()
MidasHistoryInterface * MakeMidasHistorySqlite()
MidasHistoryInterface * MakeMidasHistoryMysql()
MidasHistoryInterface * MakeMidasHistoryPgsql()
MidasHistoryInterface * MakeMidasHistoryFile()
BOOL debug
debug printouts
#define DIR_SEPARATOR_STR
MidasHistoryInterface * mh