You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.6 KiB
C++

#ifndef __MYSQL_ADO_H__
#define __MYSQL_ADO_H__
#include <string>
#include <vector>
#include <map>
#include <cstring>
using namespace std;
#include <mysql/mysql.h>
#include "basetype.h"
#include <map>
#include <vector>
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<IEC_POINT_TABLE> g_iec_points;
extern std::map<unsigned int, IEC_POINT_TABLE*> 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__