本文整理汇总了C++中DatabasePtr::shared_from_this方法的典型用法代码示例。如果您正苦于以下问题:C++ DatabasePtr::shared_from_this方法的具体用法?C++ DatabasePtr::shared_from_this怎么用?C++ DatabasePtr::shared_from_this使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabasePtr
的用法示例。
在下文中一共展示了DatabasePtr::shared_from_this方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getDependencies
//.........这里部分代码省略.........
std::vector<ForeignKey> *f = t->getForeignKeys();
for (std::vector<ForeignKey>::const_iterator it = f->begin();
it != f->end(); ++it)
{
MetadataItem *table = d->findByNameAndType(ntTable,
(*it).getReferencedTable());
if (!table)
{
throw FRError(wxString::Format(_("Table %s not found."),
(*it).getReferencedTable().c_str()));
}
Dependency de(table);
de.setFields((*it).getReferencedColumns());
list.push_back(de);
}
// Add check constraints here (CHECKS are checked via system triggers), example:
// table1::check( table1.field1 > select max(field2) from table2 )
// So, table vs any object from this ^^^ select
// Algorithm: 1.find all system triggers bound to that CHECK constraint
// 2.find dependencies for those system triggers
// 3.display those dependencies as deps. of this table
st1->Prepare("select distinct c.rdb$trigger_name from rdb$relation_constraints r "
" join rdb$check_constraints c on r.rdb$constraint_name=c.rdb$constraint_name "
" and r.rdb$constraint_type = 'CHECK' where r.rdb$relation_name= ? "
);
st1->Set(1, wx2std(getName_(), d->getCharsetConverter()));
st1->Execute();
std::vector<Dependency> tempdep;
while (st1->Fetch())
{
std::string s;
st1->Get(1, s);
Trigger t(d->shared_from_this(),
std2wxIdentifier(s, d->getCharsetConverter()));
t.getDependencies(tempdep, true);
}
// remove duplicates, and self-references from "tempdep"
while (true)
{
std::vector<Dependency>::iterator to_remove = tempdep.end();
for (std::vector<Dependency>::iterator it = tempdep.begin();
it != tempdep.end(); ++it)
{
if ((*it).getDependentObject() == this)
{
to_remove = it;
break;
}
to_remove = std::find(it + 1, tempdep.end(), (*it));
if (to_remove != tempdep.end())
break;
}
if (to_remove == tempdep.end())
break;
else
tempdep.erase(to_remove);
}
list.insert(list.end(), tempdep.begin(), tempdep.end());
}
// TODO: perhaps this could be moved to Table?
if ((typeM == ntTable || typeM == ntSysTable) && !ofObject) // foreign keys of other tables
{
st1->Prepare(
"select r1.rdb$relation_name, i.rdb$field_name "