bool CDBoperate::InsertCoordinate(CMatrix mat) { UnitRect coor; coor = mat.GetRect(m_Signatrue->nX, m_Signatrue->nY); MapCoordinate smap; smap.mapID = mat.GetMapID(); smap.nID = m_Signatrue->nId; smap.x_center = coor.centerX; smap.y_center = coor.centerY; smap.leftx = coor.left; smap.lefty = coor.top; smap.rightx = coor.right; smap.righty = coor.bottom; smap.raw = coor.raw; smap.col = coor.col; smap.realX = coor.realX; smap.realY = coor.realY; stringstream strsql; strsql << "insert into Coordinate(MapID,raw,col,x1,y1,x2,y2,x_center,y_center,x_real,y_real) values("; strsql << smap.mapID << "," ; strsql << smap.raw << "," ; strsql << smap.col << "," ; strsql << smap.leftx << ","; strsql << smap.lefty << "," ; strsql << smap.rightx << "," ; strsql << smap.righty << "," ; strsql << smap.x_center << "," ; strsql << smap.y_center << "," ; strsql << smap.realX << "," ; strsql << smap.realY << ")"; string str = strsql.str(); int res = sqlite3_exec(pDB, "begin transaction;", 0, 0, &errmsg ); res = sqlite3_exec(pDB, str.c_str(), 0, 0, &errmsg); if(res != SQLITE_OK) { cout << "error: " << errmsg << endl; return false; } res = sqlite3_exec(pDB, "commit transaction;", 0, 0, &errmsg); // cout << "Insert Coordinate successful." << endl; return true; }