GrpcPrint/TestClient/log/ScannerPowerLog.cpp

38 lines
1.0 KiB
C++
Raw Normal View History

2024-05-11 17:43:38 +08:00
#include "ScannerPowerLog.h"
ScannerPowerLog::ScannerPowerLog()
{
}
ScannerPowerLog::~ScannerPowerLog()
{
}
void ScannerPowerLog::CreateIfNoExist(SQLite::Database* db)
{
if (db == nullptr)return;
if (db->tableExists(TABLE_NAME))return;
char buffer[1024];
string createsql = "CREATE TABLE IF NOT EXISTS %s(%s INTEGER PRIMARY KEY AUTOINCREMENT,%s INTEGER,%s INTEGER,%s INTEGER,%s BLOB,%s BLOB)";
sprintf_s(buffer, sizeof(buffer), createsql.c_str(),
TABLE_NAME.c_str(),
FIELD_ID.c_str(),
FIELD_INSERT_TIME.c_str(),
FIELD_JOB_ID.c_str(),
FIELD_SNO.c_str(),
FIELD_VOLTAGE_DATA.c_str(),
FIELD_CURRENT_DATA.c_str()
);
db->exec(buffer);
}
const string ScannerPowerLog::TABLE_NAME="ScannerPower";
const string ScannerPowerLog::FIELD_ID="Id";
const string ScannerPowerLog::FIELD_JOB_ID = "JobId";
const string ScannerPowerLog::FIELD_SNO = "Sno";
const string ScannerPowerLog::FIELD_INSERT_TIME="InsertTime";
const string ScannerPowerLog::FIELD_VOLTAGE_DATA="VoltageData";
const string ScannerPowerLog::FIELD_CURRENT_DATA="CurrentData";