本文整理汇总了C++中prepared函数的典型用法代码示例。如果您正苦于以下问题:C++ prepared函数的具体用法?C++ prepared怎么用?C++ prepared使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prepared函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connect
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()));
}
示例2: deleteLater
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);
}
示例3: txn
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;
}
示例4: txn
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;
}
示例5: txn
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;
}
示例6: txn
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;
}
示例7: txn
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();
}
示例8: query
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();
}
示例9: query
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();
}
示例10: connect
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()));
}
示例11: location
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());
}
}
示例12: prepared
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)};
}
示例13: MainWindow
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()));
}
示例14: query
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();
}
示例15: l_processOptions
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);
}