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

Method connect

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

Source from the content-addressed store, hash-verified

93sqliteOperation::~sqliteOperation() { close(); }
94
95bool sqliteOperation::connect() {
96 if (dbPtr != NULL) {
97 std::cerr << "Connection exists" << std::endl;
98 return false;
99 }
100
101 int flags = SQLITE_OPEN_READWRITE;
102 if (!isFileExists(dbPath)) flags |= SQLITE_OPEN_CREATE;
103
104 if (SQLITE_OK != sqlite3_open_v2(dbPath.c_str(), &dbPtr, flags, 0)) return false;
105
106 dbCache = spatialite_alloc_connection();
107 spatialite_init_ex(dbPtr, dbCache, 0);
108
109 sqlitePackage::execSql(dbPtr, "PRAGMA foreign_keys = ON;");
110 return true;
111}
112
113bool sqliteOperation::initialize() {
114 if (NULL == dbPtr) {

Callers 2

LocalSearchMethod · 0.45
saveMapMethod · 0.45

Calls 1

isFileExistsFunction · 0.85

Tested by

no test coverage detected