#ifndef __MYSQL_ADO_H__ #define __MYSQL_ADO_H__ #include #include #include #include using namespace std; #include #include "basetype.h" #include #include struct IEC_POINT_TABLE { unsigned int sadr; unsigned int siteId; unsigned int sensorId; unsigned char sensorGroupNo; unsigned char stype; // 1: 1:遥信 2:遥测 unsigned char itemNo; }; extern std::vector g_iec_points; extern std::map g_iec_point_map; #ifdef USING_MYSQL static void show_mysql_error(MYSQL *mysql, const char* name); static void show_stmt_error(MYSQL_STMT *stmt, const char* name); static void ConvertTimestampToMySQLTime(time_t t, MYSQL_TIME& ts); inline void BindUByteValue(MYSQL_BIND& bind, const unsigned char& value); inline void BindUShortValue(MYSQL_BIND& bind, const unsigned short& value); inline void BindUIntValue(MYSQL_BIND& bind, const unsigned int& value); inline void BindULongValue(MYSQL_BIND& bind, const unsigned long long& value); inline void BindFloatValue(MYSQL_BIND& bind, const float& value); inline void BindDoubleValue(MYSQL_BIND& bind, const double& value); inline void BindValue(MYSQL_BIND& bind, const char* value, unsigned long& len); #endif // USING_MYSQL bool InitDatabase(int argc, char **argv, const char* host, const char* username, const char* password, const char* database); bool UninitDatabase(); /* 返回值: 1: 正确 0: 没有更多数据 -1: 出错 */ int GetAIPntMsg(int j, unsigned int *igno, unsigned int* iItemNo, DAY_TIME* sCurTime, float* pfValue, unsigned int *iaddr); #endif // __MYSQL_ADO_H__