MCPcopy Create free account
hub / github.com/Tencent/TAD_Sim / insertLaneBoundaries

Method insertLaneBoundaries

common/map_sdk/mapdb/src/sqlite_operation.cpp:1399–1435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1397}
1398
1399bool sqliteOperation::insertLaneBoundaries(hadmap::tx_laneboundary_vec& boundaries) {
1400 char sql[1024];
1401 sprintf(sql, "INSERT INTO '%s' (pkid, srs, lane_mark, geom) VALUES (?, ?, ?, ?)", LANE_BOUNDARY_TABLE);
1402
1403 sqliteStmtPtr stmt(dbPtr, sql);
1404 if (!stmt.status()) {
1405 std::cerr << "failed to prepare insert boundary." << std::endl;
1406 return false;
1407 }
1408 sqlite3_exec(dbPtr, "begin;", 0, 0, 0);
1409 bool complete = true;
1410 int index_base = 1;
1411 sqlite3_blob_data geom;
1412 for (hadmap::tx_laneboundary_vec::iterator iter = boundaries.begin(); iter != boundaries.end(); ++iter) {
1413 sqlite3_bind_int(stmt, index_base, iter->pkid);
1414 sqlite3_bind_int(stmt, index_base + 1, iter->srs);
1415 sqlite3_bind_int(stmt, index_base + 2, iter->lane_mark);
1416
1417 createBlob(iter->geom, iter->srs, geom);
1418 sqlite3_bind_blob(stmt, index_base + 3, geom.data, geom.size, SQLITE_TRANSIENT);
1419
1420 int r = sqlite3_step(stmt);
1421 if (SQLITE_DONE != r) {
1422 std::cerr << "Insert Boundary Error, Code " << r << std::endl;
1423 complete = false;
1424 }
1425
1426 sqlite3_clear_bindings(stmt);
1427 sqlite3_reset(stmt);
1428
1429 // iter->pkid = sqlitePackage::getLastInsertedRowid( dbPtr );
1430
1431 geom.release();
1432 }
1433 sqlite3_exec(dbPtr, "commit;", 0, 0, 0);
1434 return complete;
1435}
1436
1437bool sqliteOperation::insertLaneLinks(hadmap::tx_lanelink_vec& lanelinks) {
1438 char sql[1024];

Callers 5

insertIntoSqliteMethod · 0.80
insertIntoSqliteMethod · 0.80
insertRoadsMethod · 0.80
updateRoadsMethod · 0.80
saveMapMethod · 0.80

Calls 5

createBlobFunction · 0.85
statusMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected