/** * @brief * * 普通数据库表结构 normal_data_table * pn | id | stime | source | crc | class_id | value */ #include "normalDataDB.h" CNormalDB::CNormalDB(void* handle) { m_db = handle; } bool CNormalDB::createDataTable(void) { bool fRet=false; /* std::string sql = "create table " ; std::string tableName = "normal_data"; std::string columnStr = " (pn int, id char(8), stime int, dtime int, source char(32), value blob, primary key(pn, id)); "; sql = sql+tableName+columnStr; sqlite3_stmt *stmt=NULL; if (sqlite3_exec((sqlite3*)m_db, sql.c_str(), NULL, 0, NULL)==SQLITE_OK){ }else{ printf("create file data table fail error %s\n", sqlite3_errmsg(m_sdb)); } */ return fRet; } bool CNormalDB::readData(const json &cdt, json &outjv) { /* std::string sql = "select " ; std::string columnStr = "(pn , id , stime , source , value) from "; std::string tableName = "normal_data"; sql = sql+tableName+columnStr; sqlite3_stmt *stmt=NULL; if (sqlite3_exec((sqlite3*)m_db, sql.c_str(), NULL, 0, NULL)==SQLITE_OK){ }else{ printf("create file data table fail error %s\n", sqlite3_errmsg(m_sdb)); } */ return true; } bool CNormalDB::writeData(const json &wjv, json &outjv) { /* std::string sql = "insert into " ; std::string tableName = " normal_data "; std::string columnStr = " (pn , id , stime , dtime , source , value ) "; std::string valueStr = "(" + wjv["pn"].get() + wjv["id"].get() + wjv["stime"].get() + wjv["dtime"].get() + wjv["source"].get() + wjv["value"].get() + ")" ; sql = sql + tableName + columnStr + " values " + valueStr; sqlite3_stmt *stmt=NULL; if (sqlite3_exec((sqlite3*)m_db, sql.c_str(), NULL, 0, NULL)==SQLITE_OK){ }else{ printf("create file data table fail error %s\n", sqlite3_errmsg(m_sdb)); } */ return true; }