ソースを参照

提交修改数据库日志

madesheng 4 年 前
コミット
c6da0eeac6
2 ファイル変更12 行追加10 行削除
  1. 10 10
      src/common/sqlite3helper.cpp
  2. 2 0
      src/localization/localization.cpp

+ 10 - 10
src/common/sqlite3helper.cpp

@@ -34,10 +34,10 @@ sqlite3* Sqlite3helper::open(const char *dbname)
 
   sqlite3 *pSqlite = NULL;
   if (sqlite3_open(dbname, &pSqlite) != SQLITE_OK){
-    LOG(ERROR)<<"连接数据库失败:"<<sqlite3_errmsg(pSqlite)<<"\n";
+    LOG(ERROR)<<"connect database error:"<<sqlite3_errmsg(pSqlite);
   }
   else {
-    LOG(INFO)<< "连接数据库成功\n";
+    LOG(INFO)<< "connect database success.";
   }
   return pSqlite;
 }
@@ -59,7 +59,7 @@ int Sqlite3helper::isTableExits(sqlite3 *p, const char *tableName)
 
   int ret = sqlite3_get_table(p, sql, &pResult, &nRow, &nCol, &zErrorMsg);
   if (ret != SQLITE_OK) {
-     LOG(ERROR)<<"检查表是否存在失败, 错误信息:"<<zErrorMsg<<"\n";
+     LOG(ERROR)<<"check table errror , error=:"<<zErrorMsg<<"\n";
     result = -1;
   }
   else {
@@ -71,7 +71,7 @@ int Sqlite3helper::isTableExits(sqlite3 *p, const char *tableName)
         if (strcmp(count, "1") == 0) {
           sqlite3_free(zErrorMsg);
           sqlite3_free_table(pResult);
-          LOG(INFO)<<"表已经存在\n";
+          LOG(INFO)<<"table is exited\n";
           return 1;
         }
       } // end for
@@ -92,7 +92,7 @@ int Sqlite3helper::createTable(sqlite3 *p, const char *sql)
   int result;
   char *zErrorMsg = NULL;
   if (sqlite3_exec(p, sql, 0, 0, &zErrorMsg) != SQLITE_OK) {
-    LOG(ERROR)<<"创建表失败, 错误信息:"<< zErrorMsg;
+    LOG(ERROR)<<"create table error :"<< zErrorMsg;
     result = 0;
   }
   else
@@ -111,7 +111,7 @@ int Sqlite3helper::transaction(sqlite3 *p)
   char *zErrorMsg = NULL;
   int ret = sqlite3_exec(p, "begin transaction", 0, 0, &zErrorMsg); // 开始一个事务
   if (ret != SQLITE_OK) {
-    LOG(ERROR)<<"开始事务失败, 错误信息:"<< zErrorMsg;
+    LOG(ERROR)<<"begin transaction error:"<< zErrorMsg;
     result = 0;
   }
   else
@@ -130,7 +130,7 @@ int Sqlite3helper::commitTransaction(sqlite3 *p)
   char *zErrorMsg = NULL;
   int ret = sqlite3_exec(p, "commit transaction", 0, 0, &zErrorMsg); // 开始一个事务
   if (ret != SQLITE_OK) {
-    LOG(ERROR)<<"提交事务失败, 错误信息:%s"<< zErrorMsg;
+    LOG(ERROR)<<"commit transaction error :%s"<< zErrorMsg;
     result = 0;
   }
   else
@@ -149,7 +149,7 @@ int Sqlite3helper::rollbackTransaction(sqlite3 *p)
   char *zErrorMsg = NULL;
   int ret = sqlite3_exec(p, "rollback transaction", 0, 0, &zErrorMsg); // 开始一个事务
   if (ret != SQLITE_OK) {
-    LOG(ERROR)<<"回滚事务失败, 错误信息:"<<zErrorMsg;
+    LOG(ERROR)<<"rollback transaction error:"<<zErrorMsg;
     result = 0;
   }
   else
@@ -175,7 +175,7 @@ int Sqlite3helper::update(sqlite3 *p, const char *sql)
   int result;
   char *zErrorMsg = NULL;
   if (sqlite3_exec(p, sql, 0, 0, &zErrorMsg) != SQLITE_OK) {
-    LOG(ERROR)<<"添加或修改或删除操作失败, 错误信息:"<< zErrorMsg;
+    LOG(ERROR)<<"add or update table record:"<< zErrorMsg;
     result = 0;
   }
   else
@@ -197,7 +197,7 @@ query_result_t* Sqlite3helper::query(sqlite3 *p, const char *sql)
   int nColumn = 0;
 
   if (sqlite3_get_table(p, sql, &dbResult, &nRow, &nColumn, &zErrorMsg) != SQLITE_OK)
-    LOG(ERROR)<<"查询失败, 错误信息:"<< zErrorMsg;
+    LOG(ERROR)<<"select table error"<< zErrorMsg;
   else
     query_result = new query_result_t(nRow, nColumn, dbResult);
 

+ 2 - 0
src/localization/localization.cpp

@@ -151,6 +151,8 @@ int Localization::ParaGPRMC(std::string &strGPRMC, GPRMC &gprmc){
     {
         std::vector<std::string> nmea_gprmc = Split(strGPRMC, ",");
         gprmc.utcTime = atof(nmea_gprmc[1].c_str());
+        if ( nmea_gprmc[2].compare("V") == 0)
+             return ROBOT_FAILTURE;
         memset(&gprmc.locationStatus, 0x00, 2);
         memcpy(&gprmc.locationStatus, nmea_gprmc[2].c_str(), 1);
         gprmc. Latitude = StrToDouble(nmea_gprmc[3].c_str(), 2);