#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdarg.h>
#include <time.h>

#ifndef OMCDBLIB__H
#define OMCDBLIB__H

// by simon at 23/9/25
#ifndef MYSQL__H
#include "mysql.h"
#endif

#ifndef MYSQL_DEBUG
#define MYSQL_DEBUG 0
#endif

#define HOST_NAME			"localhost"
#define	DB_NAME				"OMC_PUB"
#define DB_PORT_NUM			0
#define SOCKET_NAME			NULL
#define FLAGS				0
#define USER_NAME			"administrator"
#define	PASSWORD			"*86#ROtartsinim"

void print_mysql_err(MYSQL * myconn);
MYSQL *mysql_conn(char *hostname, char *db_name);
MYSQL_RES *mysql_getres(MYSQL * conn, char *strsql);
int mysql_getnores(MYSQL * conn, char *strsql);
void CheckMysqlConnect(MYSQL ** conn);
int mysql_tblCpy(MYSQL * conn, const char *srcName, const char *dstName);

void insertSeriousAlarmLog(int compCode,int alarmCode);
void Print(const char *fmt,...);
void PrintTime();
void PrintEndDash();
void PrintSQL(char *sqlstr);
void PrintError(MYSQL * myconn);
int CheckError(MYSQL * myconn);

#endif
