void MainWindow::openFileDialog() { QString toOpen = QFileDialog::getOpenFileName(this,tr("Открыть базу"), "C:", tr("SQLite db files (*.sqlite)")); loadDb(toOpen); }
TEST(BranchInfo, CDKeyPerUser) { auto bi = gcRefPtr<StubBranchItemInfo2>::create(); auto info = gcRefPtr<BranchInstallInfo>::create(1, bi, UTIL::FS::g_pDefaultUTILFS); auto a = gcRefPtr<BranchInfo>::create(MCFBranch::BranchFromInt(1), DesuraId("2", "games"), info, 0, 123); auto b = gcRefPtr<BranchInfo>::create(MCFBranch::BranchFromInt(1), DesuraId("2", "games"), info, 0, 123); auto c = gcRefPtr<BranchInfo>::create(MCFBranch::BranchFromInt(1), DesuraId("2", "games"), info, 0, 456); a->setCDKey("A Test CD Key"); { std::vector<gcString> vCDKeys; a->getCDKey(vCDKeys); ASSERT_EQ(1, vCDKeys.size()); ASSERT_STREQ("A Test CD Key", vCDKeys[0].c_str()); } sqlite3x::sqlite3_connection db(":memory:"); createItemInfoDbTables(db); a->saveDbFull(&db); b->loadDb(&db); c->loadDb(&db); { std::vector<gcString> vCDKeys; b->getCDKey(vCDKeys); ASSERT_EQ(1, vCDKeys.size()); ASSERT_STREQ("A Test CD Key", vCDKeys[0].c_str()); } { std::vector<gcString> vCDKeys; c->getCDKey(vCDKeys); ASSERT_EQ(0, vCDKeys.size()); } }
void init_db(const char* path,bool mm) { int op; //op = sqlite3_open_v2("wadoku.sqlite3",&db,SQLITE_OPEN_READONLY|SQLITE_OPEN_NOMUTEX,0); if(path != NULL) { char* sql = (char*) malloc(36+ strlen(path)); sprintf( sql,"%s/wadoku.sqlite3",path); op = sqlite3_open(sql, &db); free(sql); } else { op = sqlite3_open("wadoku.sqlite3", &db); } if(op) { notify("sqlite3_open",sqlite3_errmsg(db)); } if(mm) { sqlite3 *memory_db; op = sqlite3_open(":memory:",&memory_db); if(op) { notify("sqlite3_open","failed to open memory database, could lead to slower search speed!"); op = 0; } if( SQLITE_OK == loadDb(memory_db,db)) { sqlite3_close(db); db=memory_db; } else { notify("loadDb",sqlite3_errmsg(memory_db)); sqlite3_close(memory_db); } } op = sqlite3_exec(db,"PRAGMA read_uncommitted = True;",0,0,0); if(op) { notify("read_uncommitted",sqlite3_errmsg(db)); } /* Old version without index op = sqlite3_exec(db,"CREATE TABLE ram AS SELECT * FROM wadoku.entries",0,0,0); if(op) { notify("sqlite3_exec",sqlite3_errmsg(db)); } */ }
CServiceManager::CServiceManager(iviLink::Android::AppInfo appInfo) : mpClient(0) #ifndef ANDROID , mXmlPath((std::string)SERVICE_REPOSITORY) #else , mXmlPath(appInfo.serviceRepoPath) #endif //ANDROID , mAppInfo(appInfo) { LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__); loadDb(); BaseError err = initPmal(); if(!err.isNoError()) { LOG4CPLUS_ERROR(msLogger, "CServiceManager::CServiceManager()=> PMAL component manager creation error " + static_cast<std::string>(err)); } }
void solver_batch_cb(void *data) { int num = (intptr_t)data; std::string name, exe, host; if(num == -1){ // no solver to run return; } else if(num == -2){ // just run local Gmsh client } else if(num >= 0){ // run local Gmsh client + solver num name = opt_solver_name(num, GMSH_GET, ""); exe = opt_solver_executable(num, GMSH_GET, ""); host = opt_solver_remote_login(num, GMSH_GET, ""); if(exe.empty()){ Msg::Error("Solver executable name not provided"); return; } } else{ Msg::Error("Unknown client to run in batch mode (%d)", num); return; } onelab::number n("0Metamodel/Batch", CTX::instance()->batch); n.setVisible(false); onelab::server::instance()->set(n); // create client onelab::localNetworkClient *c = 0; onelab::string o; if(name.size()){ c = new gmshLocalNetworkClient(name, exe, host); c->setIndex(num); o = c->getName() + "/Action"; } // initialize onelabUtils::runGmshClient("initialize", CTX::instance()->solver.autoMesh); if(c){ o.setValue("initialize"); onelab::server::instance()->set(o); c->run(); } // load db if(CTX::instance()->solver.autoSaveDatabase){ std::string db = SplitFileName(GModel::current()->getFileName())[0] + "onelab.db"; if(!StatFile(db)) loadDb(db); } // check onelabUtils::runGmshClient("check", CTX::instance()->solver.autoMesh); if(c){ onelabUtils::guessModelName(c); o.setValue("check"); onelab::server::instance()->set(o); c->run(); } // compute initializeLoops(); do{ onelabUtils::runGmshClient("compute", CTX::instance()->solver.autoMesh); if(c){ onelabUtils::guessModelName(c); o.setValue("compute"); onelab::server::instance()->set(o); c->run(); onelab::server::instance()->setChanged(false, c->getName()); } } while(incrementLoops()); if(CTX::instance()->solver.autoSaveDatabase || CTX::instance()->solver.autoArchiveOutputFiles){ std::string db = SplitFileName(GModel::current()->getFileName())[0] + "onelab.db"; if(CTX::instance()->solver.autoArchiveOutputFiles) archiveOutputFiles(db); if(CTX::instance()->solver.autoSaveDatabase) saveDb(db); } }