example/OfflineDataStorgeTest/OfflineDataStorgeTest/OfflineDataStorge.cpp
// save single logicFunction offline date to SQLite
save single logicFunction offline date to SQLite
save single logicFunction offline date to SQLite
void itas109::OfflineDataStorge::saveOfflineData(std::string logicFunction, std::vector<std::string> parms)
{
	std::string jsondata = offlineData2Json(logicFunction, parms);
	try
	{
		db.open("offlineData.db3");
		if (!db.tableExists("offlineDataStorge"))
		{
			std::string sql = "CREATE TABLE offlineDataStorge (id INTEGER PRIMARY KEY AUTOINCREMENT,'data'  varchar(256),'UpdateTime' TimeStamp NOT NULL DEFAULT (datetime('now','localtime')));";
			db.execDML(sql.c_str());
		}
		char strDst[2048] = { 0 };
		sprintf_s(strDst, 2048, "INSERT INTO offlineDataStorge (data,UpdateTime) VALUES('%s',datetime('now', 'localtime'));", jsondata.c_str());
		db.execDML(strDst);
		db.close();
	}
	catch (CppSQLite3Exception ex)
	{
		char logData[512] = { 0 };
		sprintf_s(logData, 512, "[OfflineDataStorge] -- Insert error! message:%s", ex.errorMessage());
		logUtil.LogOut(logData);
	}
}
void itas109 :: OfflineDataStorge :: saveOfflineData ( std :: string logicFunction , std :: vector < std :: string > parms ) { std :: string jsondata = offlineData2Json ( logicFunction , parms ) ; try { db . open ( " " ) ; if ( ! db . tableExists ( " " ) ) { std :: string sql = " " ; db . execDML ( sql . c_str ( ) ) ; } char strDst [ 2048 ] = { 0 } ; sprintf_s ( strDst , 2048 , " " , jsondata . c_str ( ) ) ; db . execDML ( strDst ) ; db . close ( ) ; } catch ( CppSQLite3Exception ex ) { char logData [ 512 ] = { 0 } ; sprintf_s ( logData , 512 , " " , ex . errorMessage ( ) ) ; logUtil . LogOut ( logData ) ; } }
save single logicFunction offline date to SQLite
save single logicFunction offline date to SQLite