void hgTpf(char *database, char *tpfDir) /* hgTpf - Make TPF table. */ { char *tempFile = "tpf.tab"; tpfDirToTabFile(tpfDir, tempFile); loadDatabase(database, tempFile); }
void hgLoadNet(char *database, char *track, int netCount, char *netFiles[]) /* hgLoadNet - Load a net file into database. */ { int i; struct lineFile *lf ; struct chainNet *net; char alignFileName[] ="align.tab"; FILE *alignFile = mustOpen(alignFileName,"w"); for (i=0; i<netCount; ++i) { lf = lineFileOpen(netFiles[i], TRUE); while ((net = chainNetRead(lf)) != NULL) { verbose(1, "read %s\n",net->name); cnWriteTables(net->name,net->fillList, alignFile, 1); chainNetFree(&net); } lineFileClose(&lf); } fclose(alignFile); if (!test) { loadDatabase(database, alignFileName, track); remove(alignFileName); } }
int main(int argc, char *argv[]) /* Read ContigInfo into hash. */ /* Filter ContigLocusId and write to ContigLocusIdFilter. */ { if (argc != 3) usage(); snpDb = argv[1]; contigGroup = argv[2]; hSetDb(snpDb); /* check for needed tables */ if(!hTableExistsDb(snpDb, "ContigLocusId")) errAbort("no ContigLocusId table in %s\n", snpDb); if(!hTableExistsDb(snpDb, "ContigInfo")) errAbort("no ContigInfo table in %s\n", snpDb); contigHash = loadContigs(contigGroup); if (contigHash == NULL) { verbose(1, "couldn't get ContigInfo hash\n"); return 1; } filterSNPs(); createTable(); loadDatabase(); return 0; }
void MainWindow::openDatabase() { QString fileName = QFileDialog::getOpenFileName(this, tr("Open Database"), ".", tr("Database files (*.db);;All files (*.*)")); if (!fileName.isEmpty()) { loadDatabase(fileName); } }
void MainWindow::openRecentFile() { QAction *action = qobject_cast<QAction *>(sender()); if (action) { loadDatabase(action->data().toString()); } }
SqliteDatabase::SqliteDatabase(const path &dbname, bool read_only) : read_only(read_only) { LOG_TRACE(logger, "Initializing database: " << dbname); loadDatabase(dbname); }
void hgPhMouse(char *database, char *track, int fileCount, char *fileNames[]) /* hgPhMouse - Load phMouse track. */ { int i; char *fileName; char *tabName = "phMouse.tab"; FILE *f = mustOpen(tabName, "w"); struct lineFile *lf; char *words[32], *s, c; int wordCount; int oneSize, totalSize = 0; for (i=0; i<fileCount; ++i) { struct bed *bedList = NULL, *bed; fileName = fileNames[i]; lf = lineFileOpen(fileName, TRUE); printf("Reading %s ", fileName); fflush(stdout); while ((wordCount = lineFileChop(lf, words)) > 0) { if (wordCount < 7) errAbort("Expecting at least 7 words line %d of %s", lf->lineIx, fileName); AllocVar(bed); bed->chrom = cloneString(words[0]); bed->chromStart = lineFileNeedNum(lf, words, 1); bed->chromEnd = lineFileNeedNum(lf, words, 2); bed->score = lineFileNeedNum(lf, words, 6); s = strrchr(words[3], '|'); c = s[1]; s[0] = 0; if (c != '+' && c != '-') errAbort("Misformed strandless trace name line %d of %s", lf->lineIx, lf->fileName); bed->name = cloneString(words[3]); bed->strand[0] = c; slAddHead(&bedList, bed); } oneSize = slCount(bedList); printf("%d alignments ", oneSize); totalSize += oneSize; fflush(stdout); slSort(&bedList, bedCmp); printf("sorted "); fflush(stdout); for (bed = bedList; bed != NULL; bed = bed->next) { int bin = hFindBin(bed->chromStart, bed->chromEnd); fprintf(f, "%d\t", bin); bedTabOutN(bed, 6, f); } printf("tabbed out\n"); bedFreeList(&bedList); } carefulClose(&f); printf("Loading %d items into %s.%s\n", totalSize, database, track); loadDatabase(database, track, tabName); remove(tabName); }
void initFlights() { programHeader(); printf("Initializing...\n"); atexit(_doOnExit); if (!loadDatabase(DB_HANDLE)) { printf("\nInitialization error. Exiting prematurely.\n"); exit(9); } }
DBImage::DBImage (QString database, typeLoading load, Mixer mix): loadPath(database), load(load), mix(mix) { nbrImgPerFace = -1; nbrFaces = -1; personTmp = NULL; idLoaded = -1; if(checkDatabase()) loadDatabase(); }
CProfileDatabase::CProfileDatabase(std::string dbPath) : mDBPath(dbPath) , mDBState(EDB_NORMAL_OK) , mpDbMutex(new CMutex) , mpRequestMutex(new CMutex) { LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__ ); loadDatabase(); printDB(); }
ProfileDatabase::ProfileDatabase(const std::string & rootFolderPath, const std::string & relativeFolderPath, const std::string & dbName) : mFolderPath(rootFolderPath + relativeFolderPath) , mDbName(dbName) , mRootFolderPath(rootFolderPath) , mDbState(EDB_NORMAL_OK) { LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__ ); loadDatabase(); printDB(); }
void OnAmxxAttach() { if (loadDatabase()) { MF_AddNatives(GeoipNatives); NativesRegistered = true; } REG_SVR_COMMAND("geoip", OnGeoipCommand); }
void MainWindow::saveAsDatabase() { QString fileName = QFileDialog::getSaveFileName(this, tr("Save Database"), ".", tr("Database files (*.db);;All files (*.*)")); if (!fileName.isEmpty()) { // Copy the current database, close it, and open the "saved as" file copyDatabase(fileName); m_dbWidget->closeDatabase(); loadDatabase(fileName); } }
void HermesGraspDatabase::init(std::string databaseFile) { loadDatabase(databaseFile); // dynamic reconfigure dynamic_reconfigure_server_.setCallback(boost::bind(&HermesGraspDatabase::dynamicReconfigureCallback, this, _1, _2)); /** * The advertiseService() function is how you tell ROS that you want to provide a service for other modules (software nodes). */ hermes_grasp_database_service_server_ = node_.advertiseService("get_grasp_for_detection", &HermesGraspDatabase::computeGraspForDetection, this); }
void hgSoftPromoter(char *database, int fileCount, char *fileNames[]) /* hgSoftPromoter - Slap Softberry promoter file into database.. */ { char *tabFile = "softPromoter.tab"; FILE *f = mustOpen(tabFile, "w"); int i; for (i=0; i<fileCount; ++i) oneFile(fileNames[i], f); carefulClose(&f); loadDatabase(database, tabFile); }
int main(int argc, char *argv[]) /* hash subsnp_class and var_str from UniVariation */ /* read SNP for univar_id, lookup into univarHash */ /* store univarHash elements in snpHash */ /* read through chrN_snpTmp, rewrite with extensions to individual chrom tables */ { struct slName *chromList, *chromPtr; char tableName[64]; if (argc != 2) usage(); snpDb = argv[1]; hSetDb(snpDb); /* check for necessary tables */ if(!hTableExistsDb(snpDb, "SNP")) errAbort("missing SNP table"); if(!hTableExistsDb(snpDb, "UniVariation")) errAbort("missing UniVariation table"); chromList = hAllChromNamesDb(snpDb); errorFileHandle = mustOpen("snpClassAndObserved.errors", "w"); univarHash = getUnivarHash(); snpHash = getSNPHash(); for (chromPtr = chromList; chromPtr != NULL; chromPtr = chromPtr->next) { safef(tableName, ArraySize(tableName), "%s_snpTmp", chromPtr->name); if (!hTableExists(tableName)) continue; verbose(1, "chrom = %s\n", chromPtr->name); processSnps(chromPtr->name); } carefulClose(&errorFileHandle); for (chromPtr = chromList; chromPtr != NULL; chromPtr = chromPtr->next) { safef(tableName, ArraySize(tableName), "%s_snpTmp", chromPtr->name); if (!hTableExists(tableName)) continue; recreateDatabaseTable(chromPtr->name); verbose(1, "loading chrom = %s\n", chromPtr->name); loadDatabase(chromPtr->name); } return 0; }
void hgLoadBed(char *database, char *track, int bedCount, char *bedFiles[]) /* hgLoadBed - Load a generic bed file into database. */ { struct lineFile *lf = NULL; int bedSize = findBedSize(bedFiles[0], &lf); struct bedStub *bedList = NULL; int i; int loadedElementCount; if ((0 == bedSize) && !ignoreEmpty) errAbort("empty input file for table %s.%s", database,track); if ((0 == bedSize) && ignoreEmpty) return; if (hasBin) bedSize--; /* verify proper usage of bedGraph column, can not be more than columns */ if ((bedGraph > 0) && (bedGraph > bedSize)) errAbort("bedGraph column %d can not be past last column, last column is %d", bedGraph, bedSize); for (i=0; i<bedCount; ++i) { /* bedFiles[0] was opened by findBedSize above -- since it might be stdin, * it's left open and reused by loadOneBed. After that, open here: */ if (i > 0) lf = lineFileOpen(bedFiles[i], TRUE); loadOneBed(lf, bedSize, &bedList); lineFileClose(&lf); } loadedElementCount = slCount(bedList); verbose(1, "Loaded %d elements of size %d\n", loadedElementCount, bedSize); if (!noSort) { slSort(&bedList, bedStubCmp); verbose(1, "Sorted\n"); } else { verbose(1, "Not Sorting\n"); slReverse(&bedList); } if (loadedElementCount > 0) loadDatabase(database, track, bedSize, bedList); else if (! ignoreEmpty) errAbort("empty input file for %s.%s", database,track); }
int main(int argc, char *argv[]) /* read ContigLocFilter, writing to individual chrom tables */ { struct hashCookie cookie; struct hashEl *hel; char *chromName; if (argc != 3) usage(); snpDb = argv[1]; contigGroup = argv[2]; hSetDb(snpDb); /* check for needed tables */ if(!hTableExistsDb(snpDb, "ContigLocFilter")) errAbort("no ContigLocFilter table in %s\n", snpDb); if(!hTableExistsDb(snpDb, "ContigInfo")) errAbort("no ContigInfo table in %s\n", snpDb); chromHash = loadChroms(contigGroup); if (chromHash == NULL) { verbose(1, "couldn't get chrom info\n"); return 1; } writeSplitTables(); verbose(1, "closing files...\n"); cookie = hashFirst(chromHash); while (hel = hashNext(&cookie)) fclose(hel->val); verbose(1, "creating tables...\n"); cookie = hashFirst(chromHash); while ((chromName = hashNextName(&cookie)) != NULL) createTable(chromName); verbose(1, "loading database...\n"); cookie = hashFirst(chromHash); while ((chromName = hashNextName(&cookie)) != NULL) { verbose(1, "chrom = %s\n", chromName); loadDatabase(chromName); } return 0; }
void PersistentCache::setValues(const Row& row) { ds::query::Result ans; // UPDATE if (row.mId > 0) { std::stringstream buf; buf << "UPDATE cache SET "; for (size_t k=0; k<mFieldFormats.mFields.size(); ++k) { const FieldFormat::Type type(mFieldFormats.mFields[k].mType); if (k != 0) buf << ", "; buf << mFieldFormats.mFields[k].mName << "="; if (type == FieldFormat::kFloat) { buf << row.getFloat(k); } else if (type == FieldFormat::kInt) { buf << row.getInt(k); } else if (type == FieldFormat::kString) { buf << "'" << row.getString(k) << "'"; } } buf << " WHERE id=" << row.mId; ds::query::Client::queryWrite(mFilename, buf.str(), ans); // CREATE } else { std::stringstream buf_1, buf_2; buf_1 << "INSERT INTO cache ("; for (size_t k=0; k<mFieldFormats.mFields.size(); ++k) { const FieldFormat::Type type(mFieldFormats.mFields[k].mType); if (k != 0) { buf_1 << ", "; buf_2 << ", "; } buf_1 << mFieldFormats.mFields[k].mName; if (type == FieldFormat::kFloat) { buf_2 << row.getFloat(k); } else if (type == FieldFormat::kInt) { buf_2 << row.getInt(k); } else if (type == FieldFormat::kString) { buf_2 << "'" << row.getString(k) << "'"; } } buf_1 << ") values (" << buf_2.str() << ")"; ds::query::Client::queryWrite(mFilename, buf_1.str(), ans); } // sync std::mutex::scoped_lock lock(mMutex); loadDatabase(mFieldFormats); }
int main(int argc, char *argv[]) /* Process command line. */ { struct traceInfo* traceInfoList; setlinebuf(stdout); setlinebuf(stderr); if (argc < 4) usage(); traceInfoList = readFastaFiles(argc-3, argv+3); loadDatabase(argv[1], argv[2], traceInfoList); slFreeList(&traceInfoList); return 0; }
int main(int argc, char *argv[]) /* read chrN_snpTmp, lookup in snpFasta, rewrite to individual chrom tables */ { struct slName *chromList, *chromPtr; char tableName[64]; if (argc != 2) usage(); snpDb = argv[1]; hSetDb(snpDb); chromList = hAllChromNamesDb(snpDb); if (chromList == NULL) { verbose(1, "couldn't get chrom info\n"); return 1; } errorFileHandle = mustOpen("snpSNP.errors", "w"); /* read into global hash */ verbose(1, "reading SNP table into hash...\n"); readSNP(); for (chromPtr = chromList; chromPtr != NULL; chromPtr = chromPtr->next) { safef(tableName, ArraySize(tableName), "%s_snpTmp", chromPtr->name); if (!hTableExists(tableName)) continue; verbose(1, "processing chrom = %s\n", chromPtr->name); processSnps(chromPtr->name); } carefulClose(&errorFileHandle); for (chromPtr = chromList; chromPtr != NULL; chromPtr = chromPtr->next) { safef(tableName, ArraySize(tableName), "%s_snpTmp", chromPtr->name); if (!hTableExists(tableName)) continue; recreateDatabaseTable(chromPtr->name); verbose(1, "loading chrom = %s\n", chromPtr->name); loadDatabase(chromPtr->name); } return 0; }
int main(int argc, char **argv) { if (argc < 4) { printUsage(); return 1; } std::string database_filename = argv[1]; std::string image_dir = argv[2]; std::string command = argv[3]; std::vector<std::string> args; for(int i = 4; i < argc; ++i) args.push_back(argv[i]); PhotoDatabase db; loadDatabase(database_filename, db); db.setPhotoPrefixPath(image_dir); if (command == "gui") { unsigned int photo_idx_start = 0; if (args.size() > 0) photo_idx_start = atoi(args[0].c_str()); GUI gui(&db, photo_idx_start); gui.run(); } else if (command == "search") { search(db, args); } else if (command == "scan") { scan(db, image_dir); } else { std::cout << "Unknown command: " << command << std::endl; return 0; } writeDatabase(db, database_filename); return 0; }
int main(int argc, char* argv[]) { #if defined(Q_OS_MAC) if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_8) QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande"); // FIX: Mac OSX 10.9 (Mavericks) font issue: https://bugreports.qt-project.org/browse/QTBUG-32789 #endif //Application::setOrganizationName("CasparCG"); //Application::setApplicationName("CasparCG Client"); Application::setGraphicsSystem("raster"); Application application(argc, argv); application.setStyle("plastique"); loadDatabase(application); DatabaseManager::getInstance().initialize(); loadStyleSheets(application); loadFonts(application); EventManager::getInstance().initialize(); GpiManager::getInstance().initialize(); MainWindow window; loadConfiguration(application, window); window.show(); LibraryManager::getInstance().initialize(); DeviceManager::getInstance().initialize(); AtemDeviceManager::getInstance().initialize(); TriCasterDeviceManager::getInstance().initialize(); OscDeviceManager::getInstance().initialize(); int returnValue = application.exec(); EventManager::getInstance().uninitialize(); DatabaseManager::getInstance().uninitialize(); GpiManager::getInstance().uninitialize(); OscDeviceManager::getInstance().uninitialize(); TriCasterDeviceManager::getInstance().uninitialize(); AtemDeviceManager::getInstance().uninitialize(); DeviceManager::getInstance().uninitialize(); LibraryManager::getInstance().uninitialize(); return returnValue; }
void ItemWindow::on_btn_item_newCategory_clicked() { if(ui->cb_item_categorie->findText(ui->le_item_category->text())==-1){ ui->le_item_category->hide(); ui->btn_item_newCategory->hide(); if(ui->cb_item_categorie->currentIndex()==0){ sqlite->addCategoryBrand(sqlite_CATEGORY, ui->le_item_category->text()); } loadDatabase(id_item); ui->cb_item_categorie->setCurrentText(ui->le_item_category->text()); ui->le_item_category->clear(); }else{ QMessageBox::warning(this, QGuiApplication::applicationDisplayName(), tr("Une marque portant le nom de %1 existe déjà.") .arg(ui->le_item_category->text())); } }
/* Constructor, takes a unique identifier * The constructor loads the database if not previously done * it then searches for the passed identifier in that database * if found it sets myComponentNumber to keep track of the data * otherwise it gives an error */ MAVLinkComponent::MAVLinkComponent(const char * identifier) { if (numberOfComponents == 0) { if (loadDatabase() && numberOfComponents == 0) { fprintf(stderr,"MAVLinkComponent can't find any components!\n"); myComponentNumber = -1; return; } } for (int i = 0; i<numberOfComponents; i++) { if (strcmp(identifier,identifiers[i]) == 0) { myComponentNumber = i; return; } } fprintf(stderr,"MAVLinkComponent can't find '%s'\n", identifier); myComponentNumber = -1; }
int main(int argc, char *argv[]) { if (argc != 2) usage(); snpDb = argv[1]; hSetDb(snpDb); outputFileHandle = mustOpen("snpPAR.tab", "w"); exceptionFileHandle = mustOpen("snpPARexceptions.tab", "w"); getSnps(); getExceptions(); loadDatabase(); carefulClose(&outputFileHandle); carefulClose(&exceptionFileHandle); return 0; }
int main(int argc, char *argv[]) /* Read ContigInfo into hash. */ /* Filter ContigLoc and write to ContigLocFilter. */ { struct sqlConnection *conn ; if (argc != 4) usage(); snpDb = argv[1]; contigGroup = argv[2]; mapGroup = argv[3]; hSetDb(snpDb); /* check for needed tables */ conn = hAllocConn(); if(!sqlTableExists(conn, "ContigLoc")) errAbort("no ContigLoc table in %s\n", snpDb); if(!sqlTableExists(conn, "ContigInfo")) errAbort("no ContigInfo table in %s\n", snpDb); if(!sqlTableExists(conn, "MapInfo")) errAbort("no MapInfo table in %s\n", snpDb); hFreeConn(&conn); loadContigChroms(contigGroup); if (contigChroms == NULL) { verbose(1, "couldn't get contigChroms hash\n"); return 2; } getWeight(); if (weightHash == NULL) { verbose(1, "couldn't get MapInfo weight hash\n"); return 3; } filterSnps(); createTable(); loadDatabase(); return 0; }
int main(int argc, char *argv[]) /* Read chromInfo into hash. */ /* Read ContigLocusIdCondense into hash. */ /* Recreate chrN_snpTmp, adding fxn_classes. */ { struct slName *chromList, *chromPtr; char tableName[64]; if (argc != 2) usage(); snpDb = argv[1]; hSetDb(snpDb); chromList = hAllChromNamesDb(snpDb); /* check for needed tables */ if(!hTableExistsDb(snpDb, "ContigLocusIdCondense")) errAbort("no ContigLocusIdCondense table in %s\n", snpDb); if(!hTableExistsDb(snpDb, "chromInfo")) errAbort("no chromInfo table in %s\n", snpDb); functionHash = createFunctionHash(); for (chromPtr = chromList; chromPtr != NULL; chromPtr = chromPtr->next) { safef(tableName, ArraySize(tableName), "%s_snpTmp", chromPtr->name); if (!hTableExists(tableName)) continue; verbose(1, "chrom = %s\n", chromPtr->name); addFunction(chromPtr->name); } for (chromPtr = chromList; chromPtr != NULL; chromPtr = chromPtr->next) { safef(tableName, ArraySize(tableName), "%s_snpTmp", chromPtr->name); if (!hTableExists(tableName)) continue; verbose(1, "loading chrom = %s\n", chromPtr->name); recreateDatabaseTable(chromPtr->name); loadDatabase(chromPtr->name); } return 0; }
struct Connection *openDatabase(char *filename, char mode) { struct Connection *conn = malloc(sizeof(struct Connection)); if (!conn) die("Memory error"); conn->db = malloc(sizeof(struct Database)); if(!conn->db) die("Memory error"); if (mode == 'c') { conn->file = fopen(filename, "w"); } else { conn->file = fopen(filename, "r+"); if (conn->file) loadDatabase(conn); } if (!conn->file) die("Failed to open the file"); return conn; }
int main(int argc, char *argv[]) /* Condense ContigLocusIdFilter and write to ContigLocusIdCondense. */ { if (argc != 2) usage(); snpDb = argv[1]; hSetDb(snpDb); /* check for needed tables */ if(!hTableExistsDb(snpDb, "ContigLocusIdFilter")) errAbort("no ContigLocusIdFilter table in %s\n", snpDb); condenseFunctionValues(); createTable(); loadDatabase(); return 0; }