void AMDirectorySynchronizerDialog::prepare(){ QApplication::setOverrideCursor(Qt::WaitCursor); mainStatusLabel_->setText("Preparing ..."); prepareButton_->setEnabled(false); startButton_->setEnabled(false); singleFileProgressBar_->setMinimum(0); singleFileProgressBar_->setMaximum(0); overallTransferProgressBar_->setMinimum(0); overallTransferProgressBar_->setMaximum(0); fileListingEdit_->clear(); errorTextEdit_->clear(); progressTextEdit_->clear(); feedbackStackWidget_->collapseItem(0); feedbackStackWidget_->collapseItem(1); feedbackStackWidget_->collapseItem(2); qRegisterMetaType<AMRecursiveDirectoryCompare::DirectoryCompareResult>("DirectorCompareResult"); connect(synchronizer_, SIGNAL(prepared(AMRecursiveDirectoryCompare::DirectoryCompareResult)), this, SLOT(onPrepared(AMRecursiveDirectoryCompare::DirectoryCompareResult))); AMThread *prepareThread = new AMThread(); connect(synchronizer_, SIGNAL(prepared(AMRecursiveDirectoryCompare::DirectoryCompareResult)), prepareThread, SLOT(onWorkerFinished())); prepareThread->setWorkerObject(synchronizer_); prepareThread->setInitialThread(thread()); synchronizer_->moveToThread(prepareThread); prepareThread->start(); QTimer::singleShot(0, synchronizer_, SLOT(prepare())); }
bool pcl::modeler::ThreadController::runWorker(AbstractWorker* worker) { if (worker->exec() != QDialog::Accepted) { delete worker; deleteLater(); return (false); } QThread* thread = new QThread; connect(this, SIGNAL(prepared()), worker, SLOT(process())); connect(worker, SIGNAL(finished()), worker, SLOT(deleteLater())); connect(worker, SIGNAL(finished()), thread, SLOT(quit())); connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); connect(worker, SIGNAL(finished()), this, SLOT(deleteLater())); worker->moveToThread(thread); thread->start(); MainWindow::getInstance().slotOnWorkerStarted(); emit prepared(); return (true); }
bool UnitRepoProxy::GetUnitStmt ::get(UnitEmitter& ue, const MD5& md5) { try { RepoTxn txn(m_repo); if (!prepared()) { std::stringstream ssSelect; ssSelect << "SELECT unitSn,preload,bc,data FROM " << m_repo.table(m_repoId, "Unit") << " WHERE md5 == @md5;"; txn.prepare(*this, ssSelect.str()); } RepoTxnQuery query(txn, *this); query.bindMd5("@md5", md5); query.step(); if (!query.row()) { return true; } int64_t unitSn; /**/ query.getInt64(0, unitSn); int preloadPriority; /**/ query.getInt(1, preloadPriority); const void* bc; size_t bclen; /**/ query.getBlob(2, bc, bclen); BlobDecoder dataBlob = /**/ query.getBlob(3); ue.m_repoId = m_repoId; ue.m_sn = unitSn; ue.m_preloadPriority = preloadPriority; ue.setBc(static_cast<const unsigned char*>(bc), bclen); ue.serdeMetaData(dataBlob); txn.commit(); } catch (RepoExc& re) { return true; } return false; }
bool UnitRepoProxy::GetSourceLocPastOffsetsStmt ::get(int64 unitSn, int line, OffsetRangeVec& ranges) { try { RepoTxn txn(m_repo); if (!prepared()) { std::stringstream ssSelect; ssSelect << "SELECT pastOffset FROM " << m_repo.table(m_repoId, "UnitSourceLoc") << " WHERE unitSn == @unitSn AND line0 <= @line" " AND line1 >= @line;"; txn.prepare(*this, ssSelect.str()); } RepoTxnQuery query(txn, *this); query.bindInt64("@unitSn", unitSn); query.bindInt("@line", line); do { query.step(); if (query.row()) { Offset pastOffset; /**/ query.getOffset(0, pastOffset); ranges.push_back(OffsetRange(pastOffset, pastOffset)); } } while (!query.done()); txn.commit(); } catch (RepoExc& re) { return true; } return false; }
bool LitstrRepoProxy::GetLitstrsStmt::get() { RepoTxn txn(m_repo); try { if (!prepared()) { std::stringstream ssSelect; ssSelect << "SELECT litstrId,litstr FROM " << m_repo.table(m_repoId, "Litstr"); txn.prepare(*this, ssSelect.str()); } RepoTxnQuery query(txn, *this); NamedEntityPairTable namedInfo; do { query.step(); if (query.row()) { StringData* litstr; /**/ query.getStaticString(1, litstr); namedInfo.emplace_back(litstr, nullptr); } } while (!query.done()); namedInfo.shrink_to_fit(); LitstrTable::get().setNamedEntityPairTable(std::move(namedInfo)); txn.commit(); } catch (RepoExc& re) { return true; } return false; }
void UnitRepoProxy::GetUnitArraysStmt ::get(UnitEmitter& ue) { RepoTxn txn(m_repo); if (!prepared()) { std::stringstream ssSelect; ssSelect << "SELECT arrayId,array FROM " << m_repo.table(m_repoId, "UnitArray") << " WHERE unitSn == @unitSn ORDER BY arrayId ASC;"; txn.prepare(*this, ssSelect.str()); } RepoTxnQuery query(txn, *this); query.bindInt64("@unitSn", ue.sn()); do { query.step(); if (query.row()) { Id arrayId; /**/ query.getId(0, arrayId); StringData* array; /**/ query.getStaticString(1, array); String s(array); Variant v = f_unserialize(s); Id id UNUSED = ue.mergeArray(v.asArrRef().get(), array); ASSERT(id == arrayId); } } while (!query.done()); txn.commit(); }
bool Repo::GetFileHashStmt::get(const char *path, MD5& md5) { try { RepoTxn txn(m_repo); if (!prepared()) { std::stringstream ssSelect; ssSelect << "SELECT f.md5 FROM " << m_repo.table(m_repoId, "FileMd5") << " AS f, " << m_repo.table(m_repoId, "Unit") << " AS u WHERE path == @path AND f.md5 == u.md5" << " ORDER BY unitSn DESC LIMIT 1;"; txn.prepare(*this, ssSelect.str()); } RepoTxnQuery query(txn, *this); query.bindText("@path", path, strlen(path)); query.step(); if (!query.row()) { return false; } query.getMd5(0, md5); txn.commit(); return true; } catch (RepoExc& re) { return false; } return false; }
bool UnitRepoProxy::GetSourceLocBaseOffsetStmt ::get(int64 unitSn, OffsetRange& range) { try { RepoTxn txn(m_repo); if (!prepared()) { std::stringstream ssSelect; ssSelect << "SELECT pastOffset FROM " << m_repo.table(m_repoId, "UnitSourceLoc") << " WHERE unitSn == @unitSn AND pastOffset < @pastOffset" " ORDER BY pastOffset DESC LIMIT 1;"; txn.prepare(*this, ssSelect.str()); } RepoTxnQuery query(txn, *this); query.bindInt64("@unitSn", unitSn); query.bindOffset("@pastOffset", range.m_past); query.step(); if (!query.row()) { // This is the first bytecode range within the unit. range.m_base = 0; } else { query.getOffset(0, range.m_base); } txn.commit(); } catch (RepoExc& re) { return true; } return false; }
void PreClassRepoProxy::GetPreClassesStmt ::get(UnitEmitter& ue) { RepoTxn txn(m_repo); if (!prepared()) { std::stringstream ssSelect; ssSelect << "SELECT preClassId,name,hoistable,extraData FROM " << m_repo.table(m_repoId, "PreClass") << " WHERE unitSn == @unitSn ORDER BY preClassId ASC;"; txn.prepare(*this, ssSelect.str()); } RepoTxnQuery query(txn, *this); query.bindInt64("@unitSn", ue.sn()); do { query.step(); if (query.row()) { Id preClassId; /**/ query.getId(0, preClassId); StringData* name; /**/ query.getStaticString(1, name); int hoistable; /**/ query.getInt(2, hoistable); BlobDecoder extraBlob = /**/ query.getBlob(3); PreClassEmitter* pce = ue.newPreClassEmitter( name, (PreClass::Hoistable)hoistable); pce->serdeMetaData(extraBlob); if (!SystemLib::s_inited) { assert(pce->attrs() & AttrPersistent); assert(pce->attrs() & AttrUnique); } assert(pce->id() == preClassId); } } while (!query.done()); txn.commit(); }
void UnitRepoProxy::GetUnitArraysStmt ::get(UnitEmitter& ue) { RepoTxn txn(m_repo); if (!prepared()) { std::stringstream ssSelect; ssSelect << "SELECT arrayId,array FROM " << m_repo.table(m_repoId, "UnitArray") << " WHERE unitSn == @unitSn ORDER BY arrayId ASC;"; txn.prepare(*this, ssSelect.str()); } RepoTxnQuery query(txn, *this); query.bindInt64("@unitSn", ue.m_sn); do { query.step(); if (query.row()) { Id arrayId; /**/ query.getId(0, arrayId); std::string key; /**/ query.getStdString(1, key); Variant v = unserialize_from_buffer(key.data(), key.size()); Id id UNUSED = ue.mergeArray( v.asArrRef().get(), ArrayData::GetScalarArrayKey(key.c_str(), key.size())); assert(id == arrayId); } } while (!query.done()); txn.commit(); }
bool UnitRepoProxy::GetSourceLocTabStmt ::get(int64_t unitSn, SourceLocTable& sourceLocTab) { try { RepoTxn txn(m_repo); if (!prepared()) { std::stringstream ssSelect; ssSelect << "SELECT pastOffset,line0,char0,line1,char1 FROM " << m_repo.table(m_repoId, "UnitSourceLoc") << " WHERE unitSn == @unitSn" " ORDER BY pastOffset ASC;"; txn.prepare(*this, ssSelect.str()); } RepoTxnQuery query(txn, *this); query.bindInt64("@unitSn", unitSn); do { query.step(); if (!query.row()) { return true; } Offset pastOffset; query.getOffset(0, pastOffset); SourceLoc sLoc; query.getInt(1, sLoc.line0); query.getInt(2, sLoc.char0); query.getInt(3, sLoc.line1); query.getInt(4, sLoc.char1); SourceLocEntry entry(pastOffset, sLoc); sourceLocTab.push_back(entry); } while (!query.done()); txn.commit(); } catch (RepoExc& re) { return true; } return false; }
void UnitRepoProxy::InsertUnitStmt ::insert(const UnitEmitter& ue, RepoTxn& txn, int64_t& unitSn, const MD5& md5, const unsigned char* bc, size_t bclen) { BlobEncoder dataBlob; if (!prepared()) { std::stringstream ssInsert; /* * Do not put preload into data; its needed to choose the * units in preloadRepo. */ ssInsert << "INSERT INTO " << m_repo.table(m_repoId, "Unit") << " VALUES(NULL, @md5, @preload, @bc, @data);"; txn.prepare(*this, ssInsert.str()); } RepoTxnQuery query(txn, *this); query.bindMd5("@md5", md5); query.bindInt("@preload", ue.m_preloadPriority); query.bindBlob("@bc", (const void*)bc, bclen); const_cast<UnitEmitter&>(ue).serdeMetaData(dataBlob); query.bindBlob("@data", dataBlob, /* static */ true); query.exec(); unitSn = query.getInsertedRowid(); }
void UnitRepoProxy::InsertUnitStmt ::insert(RepoTxn& txn, int64& unitSn, const MD5& md5, const uchar* bc, size_t bclen, const uchar* bc_meta, size_t bc_meta_len, const TypedValue* mainReturn, const LineTable& lines) { BlobEncoder linesBlob; if (!prepared()) { std::stringstream ssInsert; ssInsert << "INSERT INTO " << m_repo.table(m_repoId, "Unit") << " VALUES(NULL, @md5, @bc, @bc_meta," " @mainReturn, @mergeable, @lines);"; txn.prepare(*this, ssInsert.str()); } RepoTxnQuery query(txn, *this); query.bindMd5("@md5", md5); query.bindBlob("@bc", (const void*)bc, bclen); query.bindBlob("@bc_meta", bc_meta_len ? (const void*)bc_meta : (const void*)"", bc_meta_len); query.bindTypedValue("@mainReturn", *mainReturn); query.bindBool("@mergeable", mainReturn->_count); query.bindBlob("@lines", linesBlob(lines), /* static */ true); query.exec(); unitSn = query.getInsertedRowid(); }
bool UnitRepoProxy::GetBaseOffsetAfterPCLocStmt ::get(int64 unitSn, Offset pc, Offset& offset) { try { RepoTxn txn(m_repo); if (!prepared()) { std::stringstream ssSelect; ssSelect << "SELECT pastOffset FROM " << m_repo.table(m_repoId, "UnitSourceLoc") << " WHERE unitSn == @unitSn AND pastOffset > @pc" " ORDER BY pastOffset ASC LIMIT 1;"; txn.prepare(*this, ssSelect.str()); } RepoTxnQuery query(txn, *this); query.bindInt64("@unitSn", unitSn); query.bindOffset("@pc", pc); query.step(); if (!query.row()) { return true; } query.getOffset(0, offset); txn.commit(); } catch (RepoExc& re) { return true; } return false; }
void UnitRepoProxy::InsertUnitMergeableStmt ::insert(RepoTxn& txn, int64_t unitSn, int ix, Unit::MergeKind kind, Id id, TypedValue* value) { if (!prepared()) { std::stringstream ssInsert; ssInsert << "INSERT INTO " << m_repo.table(m_repoId, "UnitMergeables") << " VALUES(@unitSn, @mergeableIx, @mergeableKind," " @mergeableId, @mergeableValue);"; txn.prepare(*this, ssInsert.str()); } RepoTxnQuery query(txn, *this); query.bindInt64("@unitSn", unitSn); query.bindInt("@mergeableIx", ix); query.bindInt("@mergeableKind", (int)kind); query.bindId("@mergeableId", id); if (value) { assert(kind == MergeKind::Define || kind == MergeKind::PersistentDefine || kind == MergeKind::Global); query.bindTypedValue("@mergeableValue", *value); } else { assert(kind == MergeKind::ReqDoc || kind == MergeKind::TypeAlias); query.bindNull("@mergeableValue"); } query.exec(); }
void StudentWindow::showLessonWidget(int i) { LessonsDB *lessons = LessonsDBController::getDB(); Lesson lesson = lessons->getLessons().at(i); LessonsDBController::setIndex(i); this->lessonWidget->prepare(&lesson); connect(this->lessonWidget->menuWidget->lessonButton, SIGNAL(clicked()), this->lessonWidget, SLOT(transit())); connect(this->lessonWidget->menuWidget->logoutButton, SIGNAL(clicked()), this->lessonWidget, SLOT(exit())); connect(this->lessonWidget->menuWidget, SIGNAL(selectTest(bool)), this->testWidget, SLOT(prepare(bool))); connect(this->testWidget, SIGNAL(prepared()), this->testWidget, SLOT(show())); connect(this->testWidget, SIGNAL(prepared()), this->lessonWidget, SLOT(hide())); connect(this->testWidget, SIGNAL(transitLessonStudent()), this->testWidget, SLOT(hide())); connect(this->testWidget, SIGNAL(transitLessonStudent()), this->lessonWidget, SLOT(show())); }
void UnitRepoProxy::GetUnitMergeablesStmt ::get(UnitEmitter& ue) { RepoTxn txn(m_repo); if (!prepared()) { std::stringstream ssSelect; ssSelect << "SELECT mergeableIx,mergeableKind,mergeableId,mergeableValue" " FROM " << m_repo.table(m_repoId, "UnitMergeables") << " WHERE unitSn == @unitSn ORDER BY mergeableIx ASC;"; txn.prepare(*this, ssSelect.str()); } RepoTxnQuery query(txn, *this); query.bindInt64("@unitSn", ue.m_sn); do { query.step(); if (query.row()) { int mergeableIx; /**/ query.getInt(0, mergeableIx); int mergeableKind; /**/ query.getInt(1, mergeableKind); Id mergeableId; /**/ query.getInt(2, mergeableId); auto k = MergeKind(mergeableKind); if (UNLIKELY(!RuntimeOption::RepoAuthoritative)) { /* * We're using a repo generated in WholeProgram mode, * but we're not using it in RepoAuthoritative mode * (this is dodgy to start with). We're not going to * deal with requires at merge time, so drop them * here, and clear the mergeOnly flag for the unit. * The two exceptions are persistent constants and * TypeAliases which are allowed in systemlib. */ if ((k != MergeKind::PersistentDefine && k != MergeKind::TypeAlias) || SystemLib::s_inited) { ue.m_mergeOnly = false; } } switch (k) { case MergeKind::TypeAlias: ue.insertMergeableTypeAlias(mergeableIx, k, mergeableId); break; case MergeKind::ReqDoc: ue.insertMergeableInclude(mergeableIx, k, mergeableId); break; case MergeKind::PersistentDefine: case MergeKind::Define: case MergeKind::Global: { TypedValue mergeableValue; /**/ query.getTypedValue(3, mergeableValue); ue.insertMergeableDef(mergeableIx, k, mergeableId, mergeableValue); break; } default: break; } } } while (!query.done()); txn.commit(); }
void MusicSearchEngine::watchForChanges() { // Gather all folders registered on music locations QFileInfoList dirs; for (QString musicPath : SettingsPrivate::instance()->musicLocations()) { QFileInfo location(musicPath); QDirIterator it(location.absoluteFilePath(), QDir::Dirs | QDir::Hidden | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); while (it.hasNext()) { QString entry = it.next(); QFileInfo qFileInfo(entry); dirs << qFileInfo; } } SqlDatabase *db = SqlDatabase::instance(); db->open(); db->exec("PRAGMA journal_mode = MEMORY"); db->exec("PRAGMA synchronous = OFF"); db->exec("PRAGMA temp_store = 2"); db->exec("PRAGMA foreign_keys = 1"); QStringList newFoldersToAddInLibrary; // Add folders that were not found first for (QFileInfo f : dirs) { QSqlQuery query = db->exec("SELECT * FROM filesystem WHERE path = \"" + f.absoluteFilePath() + "\""); if (!query.next()) { newFoldersToAddInLibrary << f.absoluteFilePath(); QSqlQuery prepared(*db); prepared.prepare("INSERT INTO filesystem (path, lastModified) VALUES (?, ?)"); prepared.addBindValue(f.absoluteFilePath()); prepared.addBindValue(f.lastModified().toTime_t()); prepared.exec(); } } if (!newFoldersToAddInLibrary.isEmpty()) { this->doSearch(newFoldersToAddInLibrary); } // Process in reverse mode to clean cache: from database file and check if entry exists in database QStringList oldLocations; QSqlQuery cache = db->exec("SELECT * FROM filesystem"); while (cache.next()) { QDir d(cache.record().value(0).toString()); d.exists(); QFileInfo fileInfo(cache.record().value(0).toString()); // Remove folder in database because it couldn't be find in the filesystem if (!fileInfo.exists()) { db->exec("DELETE FROM filesystem WHERE path = \"" + fileInfo.absoluteFilePath() + "\""); oldLocations << fileInfo.absoluteFilePath(); } } if (!oldLocations.isEmpty()) { db->rebuild(oldLocations, QStringList()); } }
bind_result_t connection::select_impl(const std::string& statement) { std::unique_ptr<detail::prepared_statement_handle_t> prepared(new detail::prepared_statement_handle_t(prepare_statement(*_handle, statement))); if (!prepared) { throw sqlpp::exception("Sqlite3 error: Could not store result set"); } return {std::move(prepared)}; }
StudentWindow::StudentWindow(DatabaseLayer *db, User loggedInUser) : MainWindow(db, loggedInUser, new StudentMainWidget()) { this->studentMainWidget = (StudentMainWidget *)mainWidget; this->lessonWidget = new StudentLessonWidget(); this->testWidget = new TestWidget(db, email); connect(this->studentMainWidget, SIGNAL(selectedLesson(int)), this, SLOT(showLessonWidget(int))); connect(db, SIGNAL(newLessonCreated()), this, SLOT(newLessonCreated())); connect(this->lessonWidget, SIGNAL(prepared()), this->lessonWidget, SLOT(show())); connect(this->lessonWidget, SIGNAL(prepared()), this->studentMainWidget, SLOT(hide())); connect(this->lessonWidget, SIGNAL(transitLessons()), this->studentMainWidget, SLOT(show())); connect(this->lessonWidget, SIGNAL(logOut()), this, SLOT(save())); connect(this->lessonWidget, SIGNAL(logOut()), this, SLOT(logoff())); connect(this->lessonWidget, SIGNAL(transitLessons()), this->lessonWidget, SLOT(hide())); connect(this->lessonWidget, SIGNAL(logOut()), this->lessonWidget, SLOT(close())); QObject::connect(this->studentMainWidget->logOutButton, SIGNAL(clicked()), this, SLOT(save())); }
void Repo::InsertFileHashStmt::insert(RepoTxn& txn, const StringData* path, const MD5& md5) { if (!prepared()) { std::stringstream ssInsert; ssInsert << "INSERT INTO " << m_repo.table(m_repoId, "FileMd5") << " VALUES(@path, @md5);"; txn.prepare(*this, ssInsert.str()); } RepoTxnQuery query(txn, *this); query.bindStaticString("@path", path); query.bindMd5("@md5", md5); query.exec(); }
void Stage::prepare(PointTableRef table) { for (size_t i = 0; i < m_inputs.size(); ++i) { Stage *prev = m_inputs[i]; prev->prepare(table); } l_processOptions(m_options); processOptions(m_options); l_initialize(table); initialize(table); addDimensions(table.layout()); prepared(table); }
void LitstrRepoProxy::InsertLitstrStmt::insert(RepoTxn& txn, Id litstrId, const StringData* litstr) { if (!prepared()) { std::stringstream ssInsert; ssInsert << "INSERT INTO " << m_repo.table(m_repoId, "Litstr") << " VALUES(@litstrId, @litstr);"; txn.prepare(*this, ssInsert.str()); } RepoTxnQuery query(txn, *this); query.bindInt64("@litstrId", litstrId); query.bindStaticString("@litstr", litstr); query.exec(); }
void FuncRepoProxy::GetFuncsStmt ::get(UnitEmitter& ue) { RepoTxn txn(m_repo); if (!prepared()) { std::stringstream ssSelect; ssSelect << "SELECT funcSn,preClassId,name,top,extraData " "FROM " << m_repo.table(m_repoId, "Func") << " WHERE unitSn == @unitSn ORDER BY funcSn ASC;"; txn.prepare(*this, ssSelect.str()); } RepoTxnQuery query(txn, *this); query.bindInt64("@unitSn", ue.m_sn); do { query.step(); if (query.row()) { int funcSn; /**/ query.getInt(0, funcSn); Id preClassId; /**/ query.getId(1, preClassId); StringData* name; /**/ query.getStaticString(2, name); bool top; /**/ query.getBool(3, top); BlobDecoder extraBlob = /**/ query.getBlob(4); FuncEmitter* fe; if (preClassId < 0) { fe = ue.newFuncEmitter(name); } else { PreClassEmitter* pce = ue.pce(preClassId); fe = ue.newMethodEmitter(name, pce); bool added UNUSED = pce->addMethod(fe); assert(added); } assert(fe->sn() == funcSn); fe->top = top; fe->serdeMetaData(extraBlob); if (!SystemLib::s_inited && !fe->isPseudoMain()) { assert(fe->attrs & AttrBuiltin); if (preClassId < 0) { assert(fe->attrs & AttrPersistent); assert(fe->attrs & AttrUnique); assert(fe->attrs & AttrSkipFrame); } } fe->setEHTabIsSorted(); fe->finish(fe->past, true); ue.recordFunction(fe); } } while (!query.done()); txn.commit(); }
void UnitRepoProxy::InsertUnitArrayStmt ::insert(RepoTxn& txn, int64 unitSn, Id arrayId, const StringData* array) { if (!prepared()) { std::stringstream ssInsert; ssInsert << "INSERT INTO " << m_repo.table(m_repoId, "UnitArray") << " VALUES(@unitSn, @arrayId, @array);"; txn.prepare(*this, ssInsert.str()); } RepoTxnQuery query(txn, *this); query.bindInt64("@unitSn", unitSn); query.bindId("@arrayId", arrayId); query.bindStaticString("@array", array); query.exec(); }
void UnitRepoProxy::InsertUnitArrayTypeTableStmt::insert( RepoTxn& txn, int64_t unitSn, const ArrayTypeTable& att) { if (!prepared()) { std::stringstream ssInsert; ssInsert << "INSERT INTO " << m_repo.table(m_repoId, "UnitArrayTypeTable") << " VALUES(@unitSn, @arrayTypeTable);"; txn.prepare(*this, ssInsert.str()); } RepoTxnQuery query(txn, *this); query.bindInt64("@unitSn", unitSn); BlobEncoder dataBlob; dataBlob(att); query.bindBlob("@arrayTypeTable", dataBlob, /* static */ true); query.exec(); }
void UnitRepoProxy::InsertUnitPreConstStmt ::insert(RepoTxn& txn, int64 unitSn, const PreConst& pc, Id id) { if (!prepared()) { std::stringstream ssInsert; ssInsert << "INSERT INTO " << m_repo.table(m_repoId, "UnitPreConst") << " VALUES(@unitSn, @name, @value, @preConstId);"; txn.prepare(*this, ssInsert.str()); } RepoTxnQuery query(txn, *this); query.bindInt64("@unitSn", unitSn); query.bindStaticString("@name", pc.name); query.bindTypedValue("@value", pc.value); query.bindId("@preConstId", id); query.exec(); }
void Stage::prepare(PointTableRef table) { m_args.reset(new ProgramArgs); for (size_t i = 0; i < m_inputs.size(); ++i) { Stage *prev = m_inputs[i]; prev->prepare(table); } handleOptions(); pushLogLeader(); l_initialize(table); initialize(table); addDimensions(table.layout()); prepared(table); popLogLeader(); }
void PUParticleSystem3D::forceUpdate( float delta ) { if (!_emitters.empty()){ calulateRotationOffset(); prepared(); emitParticles(delta); preUpdator(delta); updator(delta); postUpdator(delta); } Vec3 currentPos = getDerivedPosition(); _latestPositionDiff = currentPos - _latestPosition; _latestPosition = currentPos; _latestOrientation = getDerivedOrientation(); _timeElapsedSinceStart += delta; }
void GraphicsVlcItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { Q_UNUSED(option); Q_UNUSED(widget); _mutex.lock(); painter->fillRect(_boundingRect, QBrush(Qt::black)); if( _frame.inited ) { QImage image(reinterpret_cast<const uchar *>(_frame.plane[0].constData()), _frame.width, _frame.height, QImage::Format_RGB32); painter->setTransform(prepared(), true); painter->drawImage(_videoRect, image); } _drawn = true; _mutex.unlock(); }