/*
* @fileName taos_database.h
* @author gaoyang
* @date 2024-12-27 17:28
* @description 
*/
#ifndef _TAOS_DATABASE_H
#define _TAOS_DATABASE_H
#include <tdengine/client/taos.h>
#include "../tag.h"

// taos总数据库名
#if EN_EMS
    #define OPC_HISTORY "opchistory"
#else
    #define OPC_HISTORY "lc_opchistory"
#endif

#define DEFINE_TAOS_HOST  "127.0.0.1"
#define DEFINE_TAOS_USERNAME "root"
#define DEFINE_TAOS_PASSWD "taosdata"
#define DEFINE_TAOS_PORT 6030

TAOS* tdengine_connect(const char* host, const int port, const char* username, const char* pass, const char* db);
void tdengine_disconnect(TAOS* tp);

int tdengine_create_table(TAOS* tp, const char* tbname, int tablen); // 在当前数据库中创建表,如果在连接时没指定数据库或未使用USE DB, 会失败
int init_taos_database_tables(proto_forward_t *proto_forward_p); // 程序初始化时检查opchistory数据库中的超级表是否存在，不存在则创建

#endif
