51 printf(
" Record type: 0x%x\n",
rec.record_type);
54 printf(
" Offset: 0x%x\n",
rec.def_offset);
58 switch (
rec.record_type)
61 fprintf(
stderr,
"Error: %s: Unexpected record type: 0x%x\n", filename,
rec.record_type);
87 int size =
rec.data_size;
93 (size < 1*1024*1024) &&
96 fprintf(
stderr,
"Error: %s: Invalid length of RT_DEF record: %d (0x%x)\n", filename, size, size);
119 fprintf(
stderr,
"Warning: %s: Event \"%s\": Fixed by truncation at forbidden TID_STRING tag \"%s\" at index %d\n", filename, event_name, tags[
i].
name,
i);
128 fprintf(
stderr,
"Warning: %s: Event \"%s\": Fixed empty tag name for tag %d: replaced with \"%s\"\n", filename, event_name,
i, tags[
i].
name);
138 fprintf(
stderr,
"Warning: %s: Event \"%s\": Fixed duplicate tag names: tag \"%s\" at index %d duplicate at index %d replaced with \"%s\"\n", filename, event_name, tags[
i].
name,
i,
j, tags[
j].
name);
154 int size =
rec.data_size;
157 printf(
"Data record, size %d.\n", size);
160 (size < 1*1024*1024))) {
162 fprintf(
stderr,
"Error: %s: Invalid length of RT_DATA record: %d (0x%x)\n", filename, size, size);
171 bufSize = 1024*((size+1023)/1024);
228 fprintf(
stderr,
"Notice: Automatically repaired some empty tag names\n");
233 fprintf(
stderr,
"Notice: Automatically repaired some duplicate tag names\n");
238 fprintf(
stderr,
"Notice: Automatically truncated events that contain tags of forbidden type TID_STRING\n");
246 fprintf(
stderr,
"Usage: mh2sql [-h] [switches...] file1.hst file2.hst ...\n");
250 fprintf(
stderr,
" --report-repaired-tags --- print messages about all repaired empty and duplicate tag names\n");
251 fprintf(
stderr,
" --hs-debug <hs_debug_flag> --- set the history debug flag\n");
252 fprintf(
stderr,
" --odbc <ODBC_DSN> --- write to ODBC (SQL) history using given ODBC DSN\n");
253 fprintf(
stderr,
" --sqlite <path> --- write to SQLITE database at the given path\n");
254 fprintf(
stderr,
" --mysql mysql_writer.txt --- write to MYSQL database\n");
255 fprintf(
stderr,
" --pgsql pgsql_writer.txt --- write to PGSQL database\n");
256 fprintf(
stderr,
" --file <path> --- write to FILE database at the given path\n");
259 fprintf(
stderr,
" mh2sql --hs-debug 1 --sqlite . 130813.hst\n");
288 if (
strcmp(arg,
"-h")==0) {
290 }
else if (
strcmp(arg,
"--report-repaired-tags") == 0) {
294 }
else if (
strcmp(arg,
"--hs-debug") == 0) {
297 }
else if (
strcmp(arg,
"--odbc") == 0) {
305 }
else if (
strcmp(arg,
"--sqlite") == 0) {
313 }
else if (
strcmp(arg,
"--mysql") == 0) {
321 }
else if (
strcmp(arg,
"--pgsql") == 0) {
329 }
else if (
strcmp(arg,
"--file") == 0) {
352 if (
strcmp(arg,
"--hs-debug") == 0) {
virtual int hs_set_debug(int debug)=0
set debug level, returns previous debug level
virtual int hs_disconnect()=0
disconnect from history, returns HS_SUCCESS
virtual int hs_connect(const char *connect_string)=0
returns HS_SUCCESS
virtual int hs_flush_buffers()=0
flush buffered data to storage where it is visible to mhttpd
virtual int hs_write_event(const char *event_name, time_t timestamp, int data_size, const char *data)=0
see hs_write_event(), returns HS_SUCCESS or HS_FILE_ERROR
virtual int hs_define_event(const char *event_name, time_t timestamp, int ntags, const TAG tags[])=0
see hs_define_event(), returns HS_SUCCESS or HS_FILE_ERROR
INT cm_get_experiment_database(HNDLE *hDB, HNDLE *hKeyClient)
INT cm_connect_experiment(const char *host_name, const char *exp_name, const char *client_name, void(*func)(char *))
INT cm_disconnect_experiment(void)
INT cm_set_watchdog_params(BOOL call_watchdog, DWORD timeout)
INT cm_msg_flush_buffer()
int hs_get_history(HNDLE hDB, HNDLE hKey, int flags, int debug_flag, MidasHistoryInterface **mh)
MidasHistoryInterface * MakeMidasHistoryODBC()
MidasHistoryInterface * MakeMidasHistorySqlite()
MidasHistoryInterface * MakeMidasHistoryMysql()
MidasHistoryInterface * MakeMidasHistoryPgsql()
MidasHistoryInterface * MakeMidasHistoryFile()
int copyHstFile(const char *filename, FILE *f, MidasHistoryInterface *mh)
int copyHst(const char *name, MidasHistoryInterface *mh)
std::map< int, const char * > gEventName
MidasHistoryInterface * mh
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)